diff options
177 files changed, 5125 insertions, 4876 deletions
diff --git a/.clang-format b/.clang-format index 9547fe1b77..dcfd0aad60 100644 --- a/.clang-format +++ b/.clang-format @@ -12,7 +12,15 @@ UseTab: Always TabWidth: 8 IndentWidth: 8 ContinuationIndentWidth: 8 -ColumnLimit: 80 + +# While we do want to enforce a character limit of 80 characters, we often +# allow lines to overflow that limit to prioritize readability. Setting a +# character limit here with penalties has been finicky and creates too many +# false positives. +# +# NEEDSWORK: It would be nice if we can find optimal settings to ensure we +# can re-enable the limit here. +ColumnLimit: 0 # C Language specifics Language: Cpp @@ -210,16 +218,11 @@ MaxEmptyLinesToKeep: 1 # No empty line at the start of a block. KeepEmptyLinesAtTheStartOfBlocks: false -# Penalties -# This decides what order things should be done if a line is too long -PenaltyBreakAssignment: 5 -PenaltyBreakBeforeFirstCallParameter: 5 -PenaltyBreakComment: 5 -PenaltyBreakFirstLessLess: 0 -PenaltyBreakOpenParenthesis: 300 -PenaltyBreakString: 5 -PenaltyExcessCharacter: 10 -PenaltyReturnTypeOnItsOwnLine: 300 - # Don't sort #include's SortIncludes: false + +# Remove optional braces of control statements (if, else, for, and while) +# according to the LLVM coding style. This avoids braces on simple +# single-statement bodies of statements but keeps braces if one side of +# if/else if/.../else cascade has multi-statement body. +RemoveBracesLLVM: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dbf9f7f12..d122e79415 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -298,7 +298,7 @@ jobs: path: build - name: Test shell: pwsh - run: meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % 10 } | Where-Object Name -EQ ${{ matrix.nr }} | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group } + run: meson test -C build --no-rebuild --print-errorlogs --slice "$(1+${{ matrix.nr }})/10" regular: name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb6d5b976c..af10ebb59a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -178,7 +178,7 @@ test:msvc-meson: - job: "build:msvc-meson" artifacts: true script: - - meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % $Env:CI_NODE_TOTAL + 1 } | Where-Object Name -EQ $Env:CI_NODE_INDEX | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group; if (!$?) { exit $LASTEXITCODE } } + - meson test -C build --no-rebuild --print-errorlogs --slice $Env:CI_NODE_INDEX/$Env:CI_NODE_TOTAL parallel: 10 test:fuzz-smoke-tests: diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc index c6bd94986c..f8d2eba061 100644 --- a/Documentation/BreakingChanges.adoc +++ b/Documentation/BreakingChanges.adoc @@ -118,6 +118,53 @@ Cf. <2f5de416-04ba-c23d-1e0b-83bb655829a7@zombino.com>, <20170223155046.e7nxivfwqqoprsqj@LykOS.localdomain>, <CA+EOSBncr=4a4d8n9xS4FNehyebpmX8JiUwCsXD47EQDE+DiUQ@mail.gmail.com>. +* The default storage format for references in newly created repositories will + be changed from "files" to "reftable". The "reftable" format provides + multiple advantages over the "files" format: ++ + ** It is impossible to store two references that only differ in casing on + case-insensitive filesystems with the "files" format. This issue is common + on Windows and macOS platforms. As the "reftable" backend does not use + filesystem paths to encode reference names this problem goes away. + ** Similarly, macOS normalizes path names that contain unicode characters, + which has the consequence that you cannot store two names with unicode + characters that are encoded differently with the "files" backend. Again, + this is not an issue with the "reftable" backend. + ** Deleting references with the "files" backend requires Git to rewrite the + complete "packed-refs" file. In large repositories with many references + this file can easily be dozens of megabytes in size, in extreme cases it + may be gigabytes. The "reftable" backend uses tombstone markers for + deleted references and thus does not have to rewrite all of its data. + ** Repository housekeeping with the "files" backend typically performs + all-into-one repacks of references. This can be quite expensive, and + consequently housekeeping is a tradeoff between the number of loose + references that accumulate and slow down operations that read references, + and compressing those loose references into the "packed-refs" file. The + "reftable" backend uses geometric compaction after every write, which + amortizes costs and ensures that the backend is always in a + well-maintained state. + ** Operations that write multiple references at once are not atomic with the + "files" backend. Consequently, Git may see in-between states when it reads + references while a reference transaction is in the process of being + committed to disk. + ** Writing many references at once is slow with the "files" backend because + every reference is created as a separate file. The "reftable" backend + significantly outperforms the "files" backend by multiple orders of + magnitude. + ** The reftable backend uses a binary format with prefix compression for + reference names. As a result, the format uses less space compared to the + "packed-refs" file. ++ +Users that get immediate benefit from the "reftable" backend could continue to +opt-in to the "reftable" format manually by setting the "init.defaultRefFormat" +config. But defaults matter, and we think that overall users will have a better +experience with less platform-specific quirks when they use the new backend by +default. ++ +A prerequisite for this change is that the ecosystem is ready to support the +"reftable" format. Most importantly, alternative implementations of Git like +JGit, libgit2 and Gitoxide need to support it. + === Removals * Support for grafting commits has long been superseded by git-replace(1). diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 6350949f2e..528b42d1dd 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -298,6 +298,9 @@ For C programs: . since late 2021 with 44ba10d6, we have had variables declared in the for loop "for (int i = 0; i < 10; i++)". + . since late 2023 with 8277dbe987 we have been using the bool type + from <stdbool.h>. + New C99 features that we cannot use yet: . %z and %zu as a printf() argument for a size_t (the %z being for diff --git a/Documentation/RelNotes/2.51.0.adoc b/Documentation/RelNotes/2.51.0.adoc index 40920e6495..f9e6a54109 100644 --- a/Documentation/RelNotes/2.51.0.adoc +++ b/Documentation/RelNotes/2.51.0.adoc @@ -40,6 +40,19 @@ UI, Workflows & Features client, instead of retrying, it skipped it by mistake, which has been corrected. + * The reftable ref backend has matured enough; Git 3.0 will make it + the default format in a newly created repositories by default. + + * "netrc" credential helper has been improved to understand textual + service names (like smtp) in addition to the numeric port numbers + (like 25). + + * Lift the limitation to use changed-path filter in "git log" so that + it can be used for a pathspec with multiple literal paths. + + * Clean up the way how signature on commit objects are exported to + and imported from fast-import stream. + Performance, Internal Implementation, Development Support etc. -------------------------------------------------------------- @@ -65,6 +78,35 @@ Performance, Internal Implementation, Development Support etc. * "git push" and "git fetch" are taught to update refs in batches to gain performance. + * Some code paths in the "git prune" used to ignore passed in + repository object and used the_repository singleton instance + instead, which has been corrected. + + * Update ".clang-format" and ".editorconfig" to match our style guide + a bit better. + + * "make coccicheck" succeeds even when spatch made suggestions, which + has been updated to fail in such a case. + + * Code clean-up around object access API. + + * Define .precision to more canned parse-options type to avoid bugs + coming from using a variable with a wrong type to capture the + parsed values. + + * Flipping the default hash function to SHA-256 at Git 3.0 boundary + is planned. + + * Declare weather-balloon we raised for "bool" type 18 months ago a + success and officially allow using the type in our codebase. + + * GIT_TEST_INSTALLED was not honored in the recent topic related to + SHA256 hashes, which has been corrected. + + * The pop_most_recent_commit() function can have quite expensive + worst case performance characteristics, which has been optimized by + using prio-queue data structure. + Fixes since v2.50 ----------------- @@ -117,8 +159,80 @@ including security updates, are included in this release. * Remove unnecessary check from "git daemon" code. (merge 0c856224d2 cb/daemon-fd-check-fix later to maint). - * Leakfix. - (merge b0e9d25865 jk/fix-leak-send-pack later to maint). + * Use of sysctl() system call to learn the total RAM size used on + BSDs has been corrected. + (merge 781c1cf571 cb/total-ram-bsd-fix later to maint). + + * Drop FreeBSD 4 support and declare that we support only FreeBSD 12 + or later, which has memmem() supported. + (merge 0392f976a7 bs/config-mak-freebsd later to maint). + + * A diff-filter with negative-only specification like "git log + --diff-filter=d" did not trigger correctly, which has been fixed. + (merge 375ac087c5 jk/all-negative-diff-filter-fix later to maint). + + * A failure to open the index file for writing due to conflicting + access did not state what went wrong, which has been corrected. + (merge 9455397a5c hy/read-cache-lock-error-fix later to maint). + + * Tempfile removal fix in the codepath to sign commits with SSH keys. + (merge 4498127b04 re/ssh-sign-buffer-fix later to maint). + + * Code and test clean-up around string-list API. + (merge 6e5b26c3ff sj/string-list later to maint). + + * "git apply -N" should start from the current index and register + only new files, but it instead started from an empty index, which + has been corrected. + (merge 2b49d97fcb rp/apply-intent-to-add-fix later to maint). + + * Leakfix with a new and a bit invasive test on pack-bitmap files. + (merge bfd5522e98 ly/load-bitmap-leakfix later to maint). + + * "git fetch --prune" used to be O(n^2) expensive when there are many + refs, which has been corrected. + (merge 87d8d8c5d0 ph/fetch-prune-optim later to maint). + + * When a ref creation at refs/heads/foo/bar fails, the files backend + now removes refs/heads/foo/ if the directory is otherwise not used. + (merge a3a7f20516 ps/refs-files-remove-empty-parent later to maint). + + * "pack-objects" has been taught to avoid pointing into objects in + cruft packs from midx. + + * "git remote" now detects remote names that overlap with each other + (e.g., remote nickname "outer" and "outer/inner" are used at the + same time), as it will lead to overlapping remote-tracking + branches. + (merge a5a727c448 jk/remote-avoid-overlapping-names later to maint). + + * The gpg.program configuration variable, which names a pathname to + the (custom) GPG compatible program, can now be spelled with ~tilde + expansion. + (merge 7d275cd5c0 jb/gpg-program-variable-is-a-pathname later to maint). + + * Our <sane-ctype.h> header file relied on that the system-supplied + <ctype.h> header is not later included, which would override our + macro definitions, but "amazon linux" broke this assumption. Fix + this by preemptively including <ctype.h> near the beginning of + <sane-ctype.h> ourselves. + (merge 9d3b33125f ps/sane-ctype-workaround later to maint). + + * Clean-up compat/bswap.h mess. + (merge f4ac32c03a ss/compat-bswap-revamp later to maint). + + * Meson-based build did not handle libexecdir setting correctly, + which has been corrected. + (merge 056dbe8612 rj/meson-libexecdir-fix later to maint). + + * Document that we do not require "real" name when signing your + patches off. + (merge 1f0fed312a bc/contribution-under-non-real-names later to maint). + + * "git commit" that concludes a conflicted merge failed to notice and remove + existing comment added automatically (like "# Conflicts:") when the + core.commentstring is set to 'auto'. + (merge 92b7c7c9f5 ac/auto-comment-char-fix later to maint). * Other code cleanup, docfix, build fix, etc. (merge b257adb571 lo/my-first-ow-doc-update later to maint). @@ -136,3 +250,13 @@ including security updates, are included in this release. (merge ff73f375bb jg/mailinfo-leakfix later to maint). (merge 996f14c02b jj/doc-branch-markup-fix later to maint). (merge 1e77de1864 cb/ci-freebsd-update-to-14.3 later to maint). + (merge b0e9d25865 jk/fix-leak-send-pack later to maint). + (merge f3a9558c8c bs/remote-helpers-doc-markup-fix later to maint). + (merge c4e9775c60 kh/doc-config-subcommands later to maint). + (merge de404249ab ps/perlless-test-fixes later to maint). + (merge 953049eed8 ts/merge-orig-head-doc-fix later to maint). + (merge 0c83bbc704 rj/freebsd-sysinfo-build-fix later to maint). + (merge ad7780b38f ps/doc-pack-refs-auto-with-files-backend-fix later to maint). + (merge f4fa8a3687 rh/doc-glob-pathspec-fix later to maint). + (merge b27be108c8 ja/doc-git-log-markup later to maint). + (merge 14d7583beb pw/config-kvi-remove-path later to maint). diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 958e3cc3d5..86ca7f6a78 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -408,8 +408,15 @@ your patch differs from project to project, so it may be different from that of the project you are accustomed to. [[real-name]] -Also notice that a real name is used in the `Signed-off-by` trailer. Please -don't hide your real name. +Please use a known identity in the `Signed-off-by` trailer, since we cannot +accept anonymous contributions. It is common, but not required, to use some form +of your real name. We realize that some contributors are not comfortable doing +so or prefer to contribute under a pseudonym or preferred name and we can accept +your patch either way, as long as the name and email you use are distinctive, +identifying, and not misleading. + +The goal of this policy is to allow us to have sufficient information to contact +you if questions arise about your contribution. [[commit-trailers]] If you like, you can put extra trailers at the end: diff --git a/Documentation/asciidoc.conf.in b/Documentation/asciidoc.conf.in index 9d9139306e..ff9ea0a294 100644 --- a/Documentation/asciidoc.conf.in +++ b/Documentation/asciidoc.conf.in @@ -43,7 +43,7 @@ ifdef::doctype-book[] endif::doctype-book[] [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@\\\*\/_^\$]+\.?)+|,)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@\\\*\/_^\$%]+\.?)+|,)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-docbook[] diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index 8b7b161349..fe64a62d96 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -73,7 +73,7 @@ module Git elsif type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$\.])/, '<literal>\1</literal>\2') .gsub(/^\.\.\.?$/, '<literal>\0</literal>') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@/_^\$\\\*]+\.{0,2})+|,)}, '\1<literal>\2</literal>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@/_^\$\\\*%]+\.{0,2})+|,)}, '\1<literal>\2</literal>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') else open, close, supports_phrase = QUOTE_TAGS[type] @@ -102,7 +102,7 @@ module Git if node.type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') .gsub(/^\.\.\.?$/, '<code>\0</code>') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*%]+\.{0,2})+)}, '\1<code>\2</code>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') else diff --git a/Documentation/config/feature.adoc b/Documentation/config/feature.adoc index cb49ff2604..924f5ff4e3 100644 --- a/Documentation/config/feature.adoc +++ b/Documentation/config/feature.adoc @@ -24,6 +24,12 @@ reusing objects from multiple packs instead of just one. * `pack.usePathWalk` may speed up packfile creation and make the packfiles be significantly smaller in the presence of certain filename collisions with Git's default name-hash. ++ +* `init.defaultRefFormat=reftable` causes newly initialized repositories to use +the reftable format for storing references. This new format solves issues with +case-insensitive filesystems, compresses better and performs significantly +better with many use cases. Refer to Documentation/technical/reftable.adoc for +more information on this new storage format. feature.manyFiles:: Enable config options that optimize for repos with many files in the diff --git a/Documentation/config/gpg.adoc b/Documentation/config/gpg.adoc index 5cf32b179d..240e46c050 100644 --- a/Documentation/config/gpg.adoc +++ b/Documentation/config/gpg.adoc @@ -1,5 +1,5 @@ gpg.program:: - Use this custom program instead of "`gpg`" found on `$PATH` when + Pathname of the program to use instead of "`gpg`" when making or verifying a PGP signature. The program must support the same command-line interface as GPG, namely, to verify a detached signature, "`gpg --verify $signature - <$file`" is run, and the diff --git a/Documentation/config/log.adoc b/Documentation/config/log.adoc index a9b160e7de..16e00e8d29 100644 --- a/Documentation/config/log.adoc +++ b/Documentation/config/log.adoc @@ -1,5 +1,5 @@ -log.abbrevCommit:: - If true, makes +`log.abbrevCommit`:: + If `true`, make ifndef::with-breaking-changes[] linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] @@ -10,62 +10,67 @@ endif::with-breaking-changes[] assume `--abbrev-commit`. You may override this option with `--no-abbrev-commit`. -log.date:: - Set the default date-time mode for the 'log' command. - Setting a value for log.date is similar to using 'git log''s +`log.date`:: + Set the default date-time mode for the `log` command. + Setting a value for log.date is similar to using `git log`'s `--date` option. See linkgit:git-log[1] for details. + If the format is set to "auto:foo" and the pager is in use, format "foo" will be used for the date format. Otherwise, "default" will be used. -log.decorate:: +`log.decorate`:: Print out the ref names of any commits that are shown by the log - command. If 'short' is specified, the ref name prefixes 'refs/heads/', - 'refs/tags/' and 'refs/remotes/' will not be printed. If 'full' is - specified, the full ref name (including prefix) will be printed. - If 'auto' is specified, then if the output is going to a terminal, - the ref names are shown as if 'short' were given, otherwise no ref - names are shown. This is the same as the `--decorate` option - of the `git log`. + command. Possible values are: ++ +---- +`short`;; the ref name prefixes `refs/heads/`, `refs/tags/` and + `refs/remotes/` are not printed. +`full`;; the full ref name (including prefix) are printed. +`auto`;; if the output is going to a terminal, + the ref names are shown as if `short` were given, otherwise no ref + names are shown. +---- ++ +This is the same as the `--decorate` option of the `git log`. -log.initialDecorationSet:: +`log.initialDecorationSet`:: By default, `git log` only shows decorations for certain known ref namespaces. If 'all' is specified, then show all refs as decorations. -log.excludeDecoration:: +`log.excludeDecoration`:: Exclude the specified patterns from the log decorations. This is similar to the `--decorate-refs-exclude` command-line option, but the config option can be overridden by the `--decorate-refs` option. -log.diffMerges:: +`log.diffMerges`:: Set diff format to be used when `--diff-merges=on` is specified, see `--diff-merges` in linkgit:git-log[1] for details. Defaults to `separate`. -log.follow:: +`log.follow`:: If `true`, `git log` will act as if the `--follow` option was used when a single <path> is given. This has the same limitations as `--follow`, i.e. it cannot be used to follow multiple files and does not work well on non-linear history. -log.graphColors:: +`log.graphColors`:: A list of colors, separated by commas, that can be used to draw history lines in `git log --graph`. -log.showRoot:: +`log.showRoot`:: If true, the initial commit will be shown as a big creation event. This is equivalent to a diff against an empty tree. Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. -log.showSignature:: +`log.showSignature`:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--show-signature`. -log.mailmap:: +`log.mailmap`:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`, otherwise assume `--no-use-mailmap`. True by default. diff --git a/Documentation/config/sendemail.adoc b/Documentation/config/sendemail.adoc index 54f1248e64..4722334657 100644 --- a/Documentation/config/sendemail.adoc +++ b/Documentation/config/sendemail.adoc @@ -31,8 +31,8 @@ sendemail.confirm:: values. sendemail.mailmap:: - If true, makes linkgit:git-send-email[1] assume `--mailmap`, - otherwise assume `--no-mailmap`. False by default. + If `true`, makes linkgit:git-send-email[1] assume `--mailmap`, + otherwise assume `--no-mailmap`. `False` by default. sendemail.mailmap.file:: The location of a linkgit:git-send-email[1] specific augmenting @@ -96,6 +96,11 @@ sendemail.xmailer:: linkgit:git-send-email[1] command-line options. See its documentation for details. +sendemail.outlookidfix:: + If `true`, makes linkgit:git-send-email[1] assume `--outlook-id-fix`, + and if `false` assume `--no-outlook-id-fix`. If not specified, it will + behave the same way as if `--outlook-id-fix` is not specified. + sendemail.signedOffCc (deprecated):: Deprecated alias for `sendemail.signedOffByCc`. diff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc index 640eb6e7db..f3a35d8141 100644 --- a/Documentation/diff-options.adoc +++ b/Documentation/diff-options.adoc @@ -37,32 +37,32 @@ endif::git-diff[] endif::git-format-patch[] ifdef::git-log[] --m:: +`-m`:: Show diffs for merge commits in the default format. This is similar to `--diff-merges=on`, except `-m` will produce no output unless `-p` is given as well. --c:: +`-c`:: Produce combined diff output for merge commits. Shortcut for `--diff-merges=combined -p`. ---cc:: +`--cc`:: Produce dense combined diff output for merge commits. Shortcut for `--diff-merges=dense-combined -p`. ---dd:: +`--dd`:: Produce diff with respect to first parent for both merge and regular commits. Shortcut for `--diff-merges=first-parent -p`. ---remerge-diff:: +`--remerge-diff`:: Produce remerge-diff output for merge commits. Shortcut for `--diff-merges=remerge -p`. ---no-diff-merges:: +`--no-diff-merges`:: Synonym for `--diff-merges=off`. ---diff-merges=<format>:: +`--diff-merges=<format>`:: Specify diff format to be used for merge commits. Default is {diff-merges-default} unless `--first-parent` is in use, in which case `first-parent` is the default. @@ -70,48 +70,54 @@ ifdef::git-log[] The following formats are supported: + -- -off, none:: +`off`:: +`none`:: Disable output of diffs for merge commits. Useful to override implied value. -on, m:: +`on`:: +`m`:: Make diff output for merge commits to be shown in the default format. The default format can be changed using `log.diffMerges` configuration variable, whose default value is `separate`. -first-parent, 1:: +`first-parent`:: +`1`:: Show full diff with respect to first parent. This is the same format as `--patch` produces for non-merge commits. -separate:: +`separate`:: Show full diff with respect to each of parents. Separate log entry and diff is generated for each parent. -combined, c:: +`combined`:: +`c`:: Show differences from each of the parents to the merge result simultaneously instead of showing pairwise diff between a parent and the result one at a time. Furthermore, it lists only files which were modified from all parents. -dense-combined, cc:: +`dense-combined`:: +`cc`:: Further compress output produced by `--diff-merges=combined` by omitting uninteresting hunks whose contents in the parents have only two variants and the merge result picks one of them without modification. -remerge, r:: - Remerge two-parent merge commits to create a temporary tree +`remerge`:: +`r`:: Remerge two-parent merge commits to create a temporary tree object--potentially containing files with conflict markers and such. A diff is then shown between that temporary tree and the actual merge commit. +-- + The output emitted when this option is used is subject to change, and so is its interaction with other options (unless explicitly documented). --- ---combined-all-paths:: + +`--combined-all-paths`:: Cause combined diffs (used for merge commits) to list the name of the file from all parents. It thus only has effect when `--diff-merges=[dense-]combined` is in use, and diff --git a/Documentation/git-apply.adoc b/Documentation/git-apply.adoc index 952518b8af..6c71ee69da 100644 --- a/Documentation/git-apply.adoc +++ b/Documentation/git-apply.adoc @@ -75,13 +75,14 @@ OPTIONS tree. If `--check` is in effect, merely check that it would apply cleanly to the index entry. +-N:: --intent-to-add:: When applying the patch only to the working tree, mark new files to be added to the index later (see `--intent-to-add` - option in linkgit:git-add[1]). This option is ignored unless - running in a Git repository and `--index` is not specified. - Note that `--index` could be implied by other options such - as `--cached` or `--3way`. + option in linkgit:git-add[1]). This option is ignored if + `--index` or `--cached` are used, and has no effect outside a Git + repository. Note that `--index` could be implied by other options + such as `--3way`. -3:: --3way:: diff --git a/Documentation/git-config.adoc b/Documentation/git-config.adoc index 936e0c5130..511b2e26bf 100644 --- a/Documentation/git-config.adoc +++ b/Documentation/git-config.adoc @@ -10,9 +10,9 @@ SYNOPSIS -------- [verse] 'git config list' [<file-option>] [<display-option>] [--includes] -'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name> -'git config set' [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value> -'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> +'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<pattern>] [--fixed-value] [--default=<default>] [--url=<url>] <name> +'git config set' [<file-option>] [--type=<type>] [--all] [--value=<pattern>] [--fixed-value] <name> <value> +'git config unset' [<file-option>] [--all] [--value=<pattern>] [--fixed-value] <name> 'git config rename-section' [<file-option>] <old-name> <new-name> 'git config remove-section' [<file-option>] <name> 'git config edit' [<file-option>] @@ -26,7 +26,7 @@ escaped. Multiple lines can be added to an option by using the `--append` option. If you want to update or unset an option which can occur on multiple -lines, a `value-pattern` (which is an extended regular expression, +lines, `--value=<pattern>` (which is an extended regular expression, unless the `--fixed-value` option is given) needs to be given. Only the existing values that match the pattern are updated or unset. If you want to handle the lines that do *not* match the pattern, just @@ -109,7 +109,7 @@ OPTIONS --replace-all:: Default behavior is to replace at most one line. This replaces - all lines matching the key (and optionally the `value-pattern`). + all lines matching the key (and optionally `--value=<pattern>`). --append:: Adds a new line to the option without altering any existing @@ -200,11 +200,19 @@ See also <<FILES>>. section in linkgit:gitrevisions[7] for a more complete list of ways to spell blob names. +`--value=<pattern>`:: +`--no-value`:: + With `get`, `set`, and `unset`, match only against + _<pattern>_. The pattern is an extended regular expression unless + `--fixed-value` is given. ++ +Use `--no-value` to unset _<pattern>_. + --fixed-value:: - When used with the `value-pattern` argument, treat `value-pattern` as + When used with `--value=<pattern>`, treat _<pattern>_ as an exact string instead of a regular expression. This will restrict the name/value pairs that are matched to only those where the value - is exactly equal to the `value-pattern`. + is exactly equal to _<pattern>_. --type <type>:: 'git config' will ensure that any input or output is valid under the given @@ -259,6 +267,12 @@ Valid `<type>`'s include: Output only the names of config variables for `list` or `get`. +`--show-names`:: +`--no-show-names`:: + With `get`, show config keys in addition to their values. The + default is `--no-show-names` unless `--url` is given and there + are no subsections in _<name>_. + --show-origin:: Augment the output of all queried config options with the origin type (file, standard input, blob, command line) and diff --git a/Documentation/git-fast-export.adoc b/Documentation/git-fast-export.adoc index 43bbb4f63c..297b57bb2e 100644 --- a/Documentation/git-fast-export.adoc +++ b/Documentation/git-fast-export.adoc @@ -50,6 +50,23 @@ resulting tag will have an invalid signature. is the same as how earlier versions of this command without this option behaved. + +When exported, a signature starts with: ++ +gpgsig <git-hash-algo> <signature-format> ++ +where <git-hash-algo> is the Git object hash so either "sha1" or +"sha256", and <signature-format> is the signature type, so "openpgp", +"x509", "ssh" or "unknown". ++ +For example, an OpenPGP signature on a SHA-1 commit starts with +`gpgsig sha1 openpgp`, while an SSH signature on a SHA-256 commit +starts with `gpgsig sha256 ssh`. ++ +While all the signatures of a commit are exported, an importer may +choose to accept only some of them. For example +linkgit:git-fast-import[1] currently stores at most one signature per +Git hash algorithm in each commit. ++ NOTE: This is highly experimental and the format of the data stream may change in the future without compatibility guarantees. diff --git a/Documentation/git-fast-import.adoc b/Documentation/git-fast-import.adoc index 250d866652..d232784200 100644 --- a/Documentation/git-fast-import.adoc +++ b/Documentation/git-fast-import.adoc @@ -445,7 +445,7 @@ one). original-oid? ('author' (SP <name>)? SP LT <email> GT SP <when> LF)? 'committer' (SP <name>)? SP LT <email> GT SP <when> LF - ('gpgsig' SP <alg> LF data)? + ('gpgsig' SP <algo> SP <format> LF data)? ('encoding' SP <encoding> LF)? data ('from' SP <commit-ish> LF)? @@ -518,13 +518,39 @@ their syntax. ^^^^^^^^ The optional `gpgsig` command is used to include a PGP/GPG signature -that signs the commit data. +or other cryptographic signature that signs the commit data. -Here <alg> specifies which hashing algorithm is used for this -signature, either `sha1` or `sha256`. +.... + 'gpgsig' SP <git-hash-algo> SP <signature-format> LF data +.... + +The `gpgsig` command takes two arguments: + +* `<git-hash-algo>` specifies which Git object format this signature + applies to, either `sha1` or `sha256`. This allows to know which + representation of the commit was signed (the SHA-1 or the SHA-256 + version) which helps with both signature verification and + interoperability between repos with different hash functions. + +* `<signature-format>` specifies the type of signature, such as + `openpgp`, `x509`, `ssh`, or `unknown`. This is a convenience for + tools that process the stream, so they don't have to parse the ASCII + armor to identify the signature type. + +A commit may have at most one signature for the SHA-1 object format +(stored in the "gpgsig" header) and one for the SHA-256 object format +(stored in the "gpgsig-sha256" header). + +See below for a detailed description of the `data` command which +contains the raw signature data. + +Signatures are not yet checked in the current implementation +though. (Already setting the `extensions.compatObjectFormat` +configuration option might help with verifying both SHA-1 and SHA-256 +object format signatures when it will be implemented.) -NOTE: This is highly experimental and the format of the data stream may -change in the future without compatibility guarantees. +NOTE: This is highly experimental and the format of the `gpgsig` +command may change in the future without compatibility guarantees. `encoding` ^^^^^^^^^^ diff --git a/Documentation/git-log.adoc b/Documentation/git-log.adoc index ae8a7e2d63..b6f3d92c43 100644 --- a/Documentation/git-log.adoc +++ b/Documentation/git-log.adoc @@ -8,8 +8,8 @@ git-log - Show commit logs SYNOPSIS -------- -[verse] -'git log' [<options>] [<revision-range>] [[--] <path>...] +[synopsis] +git log [<options>] [<revision-range>] [[--] <path>...] DESCRIPTION ----------- @@ -27,28 +27,34 @@ each commit introduces are shown. OPTIONS ------- ---follow:: +`--follow`:: Continue listing the history of a file beyond renames (works only for a single file). ---no-decorate:: ---decorate[=short|full|auto|no]:: - Print out the ref names of any commits that are shown. If 'short' is - specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and - 'refs/remotes/' will not be printed. If 'full' is specified, the - full ref name (including prefix) will be printed. If 'auto' is - specified, then if the output is going to a terminal, the ref names - are shown as if 'short' were given, otherwise no ref names are - shown. The option `--decorate` is short-hand for `--decorate=short`. - Default to configuration value of `log.decorate` if configured, - otherwise, `auto`. - ---decorate-refs=<pattern>:: ---decorate-refs-exclude=<pattern>:: +`--no-decorate`:: +`--decorate[=(short|full|auto|no)]`:: + Print out the ref names of any commits that are shown. Possible values + are: ++ +---- +`short`;; the ref name prefixes `refs/heads/`, `refs/tags/` and + `refs/remotes/` are not printed. +`full`;; the full ref name (including prefix) is printed. +`auto`:: if the output is going to a terminal, the ref names + are shown as if `short` were given, otherwise no ref names are + shown. +---- ++ +The option `--decorate` is short-hand for `--decorate=short`. Default to +configuration value of `log.decorate` if configured, otherwise, `auto`. + +`--decorate-refs=<pattern>`:: +`--decorate-refs-exclude=<pattern>`:: For each candidate reference, do not use it for decoration if it - matches any patterns given to `--decorate-refs-exclude` or if it - doesn't match any of the patterns given to `--decorate-refs`. The - `log.excludeDecoration` config option allows excluding refs from + matches any of the _<pattern>_ parameters given to + `--decorate-refs-exclude` or if it doesn't match any of the + _<pattern>_ parameters given to `--decorate-refs`. + The `log.excludeDecoration` config option allows excluding refs from the decorations, but an explicit `--decorate-refs` pattern will override a match in `log.excludeDecoration`. + @@ -56,51 +62,51 @@ If none of these options or config settings are given, then references are used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`, `refs/stash/`, or `refs/tags/`. ---clear-decorations:: +`--clear-decorations`:: When specified, this option clears all previous `--decorate-refs` or `--decorate-refs-exclude` options and relaxes the default decoration filter to include all references. This option is assumed if the config value `log.initialDecorationSet` is set to `all`. ---source:: +`--source`:: Print out the ref name given on the command line by which each commit was reached. ---[no-]mailmap:: ---[no-]use-mailmap:: +`--[no-]mailmap`:: +`--[no-]use-mailmap`:: Use mailmap file to map author and committer names and email addresses to canonical real names and email addresses. See linkgit:git-shortlog[1]. ---full-diff:: +`--full-diff`:: Without this flag, `git log -p <path>...` shows commits that touch the specified paths, and diffs about the same specified paths. With this, the full diff is shown for commits that touch - the specified paths; this means that "<path>..." limits only + the specified paths; this means that "`<path>...`" limits only commits, and doesn't limit diff for those commits. + Note that this affects all diff-based output types, e.g. those produced by `--stat`, etc. ---log-size:: - Include a line ``log size <number>'' in the output for each commit, - where <number> is the length of that commit's message in bytes. +`--log-size`:: + Include a line `log size <number>` in the output for each commit, + where _<number>_ is the length of that commit's message in bytes. Intended to speed up tools that read log messages from `git log` output by allowing them to allocate space in advance. include::line-range-options.adoc[] -<revision-range>:: +_<revision-range>_:: Show only commits in the specified revision range. When no - <revision-range> is specified, it defaults to `HEAD` (i.e. the + _<revision-range>_ is specified, it defaults to `HEAD` (i.e. the whole history leading to the current commit). `origin..HEAD` specifies all the commits reachable from the current commit (i.e. `HEAD`), but not from `origin`. For a complete list of - ways to spell <revision-range>, see the 'Specifying Ranges' + ways to spell _<revision-range>_, see the 'Specifying Ranges' section of linkgit:gitrevisions[7]. -[--] <path>...:: +`[--] <path>...`:: Show only commits that are enough to explain how the files that match the specified paths came to be. See 'History Simplification' below for details and other simplification @@ -145,14 +151,14 @@ EXAMPLES `git log --since="2 weeks ago" -- gitk`:: - Show the changes during the last two weeks to the file 'gitk'. + Show the changes during the last two weeks to the file `gitk`. The `--` is necessary to avoid confusion with the *branch* named - 'gitk' + `gitk` `git log --name-status release..test`:: - Show the commits that are in the "test" branch but not yet - in the "release" branch, along with the list of paths + Show the commits that are in the "`test`" branch but not yet + in the "`release`" branch, along with the list of paths each commit modifies. `git log --follow builtin/rev-list.c`:: @@ -164,7 +170,7 @@ EXAMPLES `git log --branches --not --remotes=origin`:: Shows all commits that are in any of local branches but not in - any of remote-tracking branches for 'origin' (what you have that + any of remote-tracking branches for `origin` (what you have that origin doesn't). `git log master --not --remotes=*/master`:: @@ -200,11 +206,11 @@ CONFIGURATION See linkgit:git-config[1] for core variables and linkgit:git-diff[1] for settings related to diff generation. -format.pretty:: +`format.pretty`:: Default for the `--format` option. (See 'Pretty Formats' above.) Defaults to `medium`. -i18n.logOutputEncoding:: +`i18n.logOutputEncoding`:: Encoding to use when displaying logs. (See 'Discussion' above.) Defaults to the value of `i18n.commitEncoding` if set, and UTF-8 otherwise. diff --git a/Documentation/git-merge.adoc b/Documentation/git-merge.adoc index d53923c3b7..a055384ad6 100644 --- a/Documentation/git-merge.adoc +++ b/Documentation/git-merge.adoc @@ -28,8 +28,8 @@ Assume the following history exists and the current branch is `master`: ------------ - A---B---C topic - / + A---B---C topic + / D---E---F---G master ------------ @@ -38,11 +38,11 @@ Then `git merge topic` will replay the changes made on the 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. Before the operation, -`ORIG_HEAD` is set to the tip of the current branch (`C`). +`ORIG_HEAD` is set to the tip of the current branch (`G`). ------------ - A---B---C topic - / \ + A---B---C topic + / \ D---E---F---G---H master ------------ diff --git a/Documentation/git-pack-refs.adoc b/Documentation/git-pack-refs.adoc index 652c549771..42b90051e6 100644 --- a/Documentation/git-pack-refs.adoc +++ b/Documentation/git-pack-refs.adoc @@ -66,7 +66,10 @@ Pack refs as needed depending on the current state of the ref database. The behavior depends on the ref format used by the repository and may change in the future. + - - "files": No special handling for `--auto` has been implemented. + - "files": Loose references are packed into the `packed-refs` file + based on the ratio of loose references to the size of the + `packed-refs` file. The bigger the `packed-refs` file, the more loose + references need to exist before we repack. + - "reftable": Tables are compacted such that they form a geometric sequence. For two tables N and N+1, where N+1 is newer, this diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index 7bd09c254b..5335502d68 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -280,12 +280,14 @@ must be used for each option. Path to a store of trusted CA certificates for SMTP SSL/TLS certificate validation (either a directory that has been processed by `c_rehash`, or a single file containing one or more PEM format - certificates concatenated together: see verify(1) -CAfile and - -CApath for more information on these). Set it to an empty string - to disable certificate verification. Defaults to the value of the - `sendemail.smtpSSLCertPath` configuration variable, if set, or the - backing SSL library's compiled-in default otherwise (which should - be the best choice on most platforms). + certificates concatenated together: see the description of the + `-CAfile` _<file>_ and the `-CApath` _<dir>_ options of + https://docs.openssl.org/master/man1/openssl-verify/ + [OpenSSL's verify(1) manual page] for more information on these). + Set it to an empty string to disable certificate verification. + Defaults to the value of the `sendemail.smtpSSLCertPath` configuration + variable, if set, or the backing SSL library's compiled-in default + otherwise (which should be the best choice on most platforms). --smtp-user=<user>:: Username for SMTP-AUTH. Default is the value of `sendemail.smtpUser`; @@ -598,9 +600,20 @@ available online. Community maintained credential helpers are also available: - https://github.com/AdityaGarg8/git-credential-email[git-credential-yahoo] (cross platform, dedicated helper for authenticating Yahoo accounts) + - https://github.com/AdityaGarg8/git-credential-email[git-credential-aol] + (cross platform, dedicated helper for authenticating AOL accounts) + You can also see linkgit:gitcredentials[7] for more OAuth based authentication helpers. +Proton Mail does not provide an SMTP server to send emails. If you are a paid +customer of Proton Mail, you can use +https://proton.me/mail/bridge[Proton Mail Bridge] +officially provided by Proton Mail to create a local SMTP server for sending +emails. For both free and paid users, community maintained projects like +https://github.com/AdityaGarg8/git-credential-email[git-protonmail] can be +used. + Note: the following core Perl modules that may be installed with your distribution of Perl are required: @@ -614,6 +627,35 @@ These additional Perl modules are also required: https://metacpan.org/pod/Authen::SASL[Authen::SASL] and https://metacpan.org/pod/Mail::Address[Mail::Address]. +Exploiting the `sendmailCmd` option of `git send-email` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Apart from sending emails via an SMTP server, `git send-email` can also send +emails through any application that supports sendmail-like commands. You can +read documentation of `--sendmail-cmd=<command>` above for more information. +This ability can be very useful if you want to use another application as an +SMTP client for `git send-email`, or if your email provider uses proprietary +APIs instead of SMTP to send emails. + +As an example, lets see how to configure https://marlam.de/msmtp/[msmtp], a +popular SMTP client found in many Linux distributions. Edit `~/.gitconfig` +to instruct `git-send-email` to use it for sending emails. + +---- +[sendemail] + sendmailCmd = /usr/bin/msmtp # Change this to the path where msmtp is installed +---- + +Links of a few such community maintained helpers are: + + - https://marlam.de/msmtp/[msmtp] + (popular SMTP client with many features, available for Linux and macOS) + + - https://github.com/AdityaGarg8/git-credential-email[git-protonmail] + (cross platform client that can send emails using the ProtonMail API) + + - https://github.com/AdityaGarg8/git-credential-email[git-msgraph] + (cross platform client that can send emails using the Microsoft Graph API) SEE ALSO -------- diff --git a/Documentation/gitremote-helpers.adoc b/Documentation/gitremote-helpers.adoc index d0be008e5e..39cdece16e 100644 --- a/Documentation/gitremote-helpers.adoc +++ b/Documentation/gitremote-helpers.adoc @@ -498,7 +498,7 @@ set by Git if the remote helper has the 'option' capability. ask for the tag specifically. Some helpers may be able to use this option to avoid a second network connection. -'option dry-run' {'true'|'false'}: +'option dry-run' {'true'|'false'}:: If true, pretend the operation completed successfully, but don't actually change any repository data. For most helpers this only applies to the 'push', if supported. diff --git a/Documentation/glossary-content.adoc b/Documentation/glossary-content.adoc index 575c18f776..e423e4765b 100644 --- a/Documentation/glossary-content.adoc +++ b/Documentation/glossary-content.adoc @@ -418,9 +418,8 @@ full pathname may have special meaning: - A leading "`**`" followed by a slash means match in all directories. For example, "`**/foo`" matches file or directory - "`foo`" anywhere, the same as pattern "`foo`". "`**/foo/bar`" - matches file or directory "`bar`" anywhere that is directly - under directory "`foo`". + "`foo`" anywhere. "`**/foo/bar`" matches file or directory "`bar`" + anywhere that is directly under directory "`foo`". - A trailing "`/**`" matches everything inside. For example, "`abc/**`" matches all files inside directory "abc", relative diff --git a/Documentation/line-range-format.adoc b/Documentation/line-range-format.adoc index 9b51e9fb66..3cc2a14544 100644 --- a/Documentation/line-range-format.adoc +++ b/Documentation/line-range-format.adoc @@ -1,30 +1,30 @@ -'<start>' and '<end>' can take one of these forms: +_<start>_ and _<end>_ can take one of these forms: -- number +- _<number>_ + -If '<start>' or '<end>' is a number, it specifies an +If _<start>_ or _<end>_ is a number, it specifies an absolute line number (lines count from 1). + -- `/regex/` +- `/<regex>/` + This form will use the first line matching the given -POSIX regex. If '<start>' is a regex, it will search from the end of +POSIX _<regex>_. If _<start>_ is a regex, it will search from the end of the previous `-L` range, if any, otherwise from the start of file. -If '<start>' is `^/regex/`, it will search from the start of file. -If '<end>' is a regex, it will search -starting at the line given by '<start>'. +If _<start>_ is `^/<regex>/`, it will search from the start of file. +If _<end>_ is a regex, it will search starting at the line given by +_<start>_. + -- +offset or -offset +- `+<offset>` or `-<offset>` + -This is only valid for '<end>' and will specify a number -of lines before or after the line given by '<start>'. +This is only valid for _<end>_ and will specify a number +of lines before or after the line given by _<start>_. + -If `:<funcname>` is given in place of '<start>' and '<end>', it is a +If `:<funcname>` is given in place of _<start>_ and _<end>_, it is a regular expression that denotes the range from the first funcname line -that matches '<funcname>', up to the next funcname line. `:<funcname>` +that matches _<funcname>_, up to the next funcname line. `:<funcname>` searches from the end of the previous `-L` range, if any, otherwise from the start of file. `^:<funcname>` searches from the start of file. The function names are determined in the same way as `git diff` diff --git a/Documentation/line-range-options.adoc b/Documentation/line-range-options.adoc index f275df3b69..c44ba05320 100644 --- a/Documentation/line-range-options.adoc +++ b/Documentation/line-range-options.adoc @@ -1,12 +1,12 @@ --L<start>,<end>:<file>:: --L:<funcname>:<file>:: +`-L<start>,<end>:<file>`:: +`-L:<funcname>:<file>`:: - Trace the evolution of the line range given by '<start>,<end>', - or by the function name regex '<funcname>', within the '<file>'. You may + Trace the evolution of the line range given by `<start>,<end>`, + or by the function name regex _<funcname>_, within the _<file>_. You may not give any pathspec limiters. This is currently limited to a walk starting from a single revision, i.e., you may only give zero or one positive revision arguments, and - '<start>' and '<end>' (or '<funcname>') must exist in the starting revision. + _<start>_ and _<end>_ (or _<funcname>_) must exist in the starting revision. You can specify this option more than once. Implies `--patch`. Patch output can be suppressed using `--no-patch`, but other diff formats (namely `--raw`, `--numstat`, `--shortstat`, `--dirstat`, `--summary`, diff --git a/Documentation/meson.build b/Documentation/meson.build index 2fe1a1369d..4404c623f0 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -375,8 +375,7 @@ foreach manpage, category : manpages output: fs.stem(manpage) + '.xml', ) - manpage_path = fs.stem(manpage) + '.' + category.to_string() - manpage_target = custom_target( + custom_target( command: [ xmlto, '-m', '@INPUT0@', @@ -392,7 +391,7 @@ foreach manpage, category : manpages 'manpage-normal.xsl', 'manpage-bold-literal.xsl', ], - output: manpage_path, + output: fs.stem(manpage) + '.' + category.to_string(), install: true, install_dir: get_option('mandir') / 'man' + category.to_string(), ) diff --git a/Documentation/pretty-formats.adoc b/Documentation/pretty-formats.adoc index 07475de8c3..9ed0417fc8 100644 --- a/Documentation/pretty-formats.adoc +++ b/Documentation/pretty-formats.adoc @@ -2,11 +2,11 @@ PRETTY FORMATS -------------- If the commit is a merge, and if the pretty-format -is not 'oneline', 'email' or 'raw', an additional line is -inserted before the 'Author:' line. This line begins with +is not `oneline`, `email` or `raw`, an additional line is +inserted before the `Author:` line. This line begins with "Merge: " and the hashes of ancestral commits are printed, separated by spaces. Note that the listed commits may not -necessarily be the list of the *direct* parent commits if you +necessarily be the list of the 'direct' parent commits if you have limited your view of history: for example, if you are only interested in changes related to a certain directory or file. @@ -14,24 +14,24 @@ file. There are several built-in formats, and you can define additional formats by setting a pretty.<name> config option to either another format name, or a -'format:' string, as described below (see +`format:` string, as described below (see linkgit:git-config[1]). Here are the details of the built-in formats: -* 'oneline' +* `oneline` <hash> <title-line> + This is designed to be as compact as possible. -* 'short' +* `short` commit <hash> Author: <author> <title-line> -* 'medium' +* `medium` commit <hash> Author: <author> @@ -41,7 +41,7 @@ This is designed to be as compact as possible. <full-commit-message> -* 'full' +* `full` commit <hash> Author: <author> @@ -51,7 +51,7 @@ This is designed to be as compact as possible. <full-commit-message> -* 'fuller' +* `fuller` commit <hash> Author: <author> @@ -63,18 +63,18 @@ This is designed to be as compact as possible. <full-commit-message> -* 'reference' +* `reference` <abbrev-hash> (<title-line>, <short-author-date>) + This format is used to refer to another commit in a commit message and -is the same as `--pretty='format:%C(auto)%h (%s, %ad)'`. By default, +is the same as ++--pretty=\'format:%C(auto)%h (%s, %ad)'++. By default, the date is formatted with `--date=short` unless another `--date` option is explicitly specified. As with any `format:` with format placeholders, its output is not affected by other options like `--decorate` and `--walk-reflogs`. -* 'email' +* `email` From <hash> <date> From: <author> @@ -83,30 +83,30 @@ placeholders, its output is not affected by other options like <full-commit-message> -* 'mboxrd' +* `mboxrd` + -Like 'email', but lines in the commit message starting with "From " +Like `email`, but lines in the commit message starting with "From " (preceded by zero or more ">") are quoted with ">" so they aren't confused as starting a new commit. -* 'raw' +* `raw` + -The 'raw' format shows the entire commit exactly as +The `raw` format shows the entire commit exactly as stored in the commit object. Notably, the hashes are -displayed in full, regardless of whether --abbrev or ---no-abbrev are used, and 'parents' information show the +displayed in full, regardless of whether `--abbrev` or +`--no-abbrev` are used, and 'parents' information show the true parent commits, without taking grafts or history simplification into account. Note that this format affects the way commits are displayed, but not the way the diff is shown e.g. with `git log --raw`. To get full object names in a raw diff format, use `--no-abbrev`. -* 'format:<format-string>' +* `format:<format-string>` + -The 'format:<format-string>' format allows you to specify which information +The `format:<format-string>` format allows you to specify which information you want to show. It works a little bit like printf format, -with the notable exception that you get a newline with '%n' -instead of '\n'. +with the notable exception that you get a newline with `%n` +instead of `\n`. + E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"' would show something like this: @@ -120,158 +120,161 @@ The title was >>t4119: test autocomputing -p<n> for traditional diff input.<< The placeholders are: - Placeholders that expand to a single literal character: -'%n':: newline -'%%':: a raw '%' -'%x00':: '%x' followed by two hexadecimal digits is replaced with a +++%n++:: newline +++%%++:: a raw ++%++ +++%x00++:: ++%x++ followed by two hexadecimal digits is replaced with a byte with the hexadecimal digits' value (we will call this "literal formatting code" in the rest of this document). - Placeholders that affect formatting of later placeholders: -'%Cred':: switch color to red -'%Cgreen':: switch color to green -'%Cblue':: switch color to blue -'%Creset':: reset color -'%C(...)':: color specification, as described under Values in the +++%Cred++:: switch color to red +++%Cgreen++:: switch color to green +++%Cblue++:: switch color to blue +++%Creset++:: reset color +++%C(++_<spec>_++)++:: color specification, as described under Values in the "CONFIGURATION FILE" section of linkgit:git-config[1]. By default, colors are shown only when enabled for log output (by `color.diff`, `color.ui`, or `--color`, and respecting the `auto` settings of the former if we are going to a - terminal). `%C(auto,...)` is accepted as a historical - synonym for the default (e.g., `%C(auto,red)`). Specifying - `%C(always,...)` will show the colors even when color is + terminal). ++%C(auto,++_<spec>_++)++ is accepted as a historical + synonym for the default (e.g., ++%C(auto,red)++). Specifying + ++%C(always,++_<spec>_++)++ will show the colors even when color is not otherwise enabled (though consider just using - `--color=always` to enable color for the whole output, + `--color=always` to enable color for the whole output, including this format and anything else git might color). - `auto` alone (i.e. `%C(auto)`) will turn on auto coloring + `auto` alone (i.e. ++%C(auto)++) will turn on auto coloring on the next placeholders until the color is switched again. -'%m':: left (`<`), right (`>`) or boundary (`-`) mark -'%w([<w>[,<i1>[,<i2>]]])':: switch line wrapping, like the -w option of +++%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 +++%<(++`<n>[,(trunc|ltrunc|mtrunc)]`++)++:: make the next placeholder take at least N column widths, padding spaces on the right if necessary. Optionally - truncate (with ellipsis '..') at the left (ltrunc) `..ft`, + 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. + _<n>_ columns. Note 1: that truncating - only works correctly with N >= 2. - Note 2: spaces around the N and M (see below) + only works correctly with _<n>_ >= 2. + 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 +++%<|(++_<m>_ ++)++:: make the next placeholder take at least until _<m>_ th display column, padding spaces on the right if necessary. - Use negative M values for column positions measured + Use negative _<m>_ values for column positions measured from the right hand edge of the terminal window. -'%>( <N> )', '%>|( <M> )':: similar to '%<( <N> )', '%<|( <M> )' respectively, +++%>(++_<n>_++)++:: +++%>|(++_<m>_++)++:: similar to ++%<(++_<n>_++)++, ++%<|(++_<m>_++)++ respectively, but padding spaces on the left -'%>>( <N> )', '%>>|( <M> )':: similar to '%>( <N> )', '%>|( <M> )' +++%>>(++_<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> )', '%><|( <M> )':: similar to '%<( <N> )', '%<|( <M> )' +++%><(++_<n>_++)++:: +++%><|(++_<m>_++)++:: similar to ++%<(++_<n>_++)++, ++%<|(++_<m>_++)++ respectively, but padding both sides (i.e. the text is centered) - Placeholders that expand to information extracted from the commit: -'%H':: commit hash -'%h':: abbreviated commit hash -'%T':: tree hash -'%t':: abbreviated tree hash -'%P':: parent hashes -'%p':: abbreviated parent hashes -'%an':: author name -'%aN':: author name (respecting .mailmap, see linkgit:git-shortlog[1] ++%H+:: commit hash ++%h+:: abbreviated commit hash ++%T+:: tree hash ++%t+:: abbreviated tree hash ++%P+:: parent hashes ++%p+:: abbreviated parent hashes ++%an+:: author name ++%aN+:: author name (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%ae':: author email -'%aE':: author email (respecting .mailmap, see linkgit:git-shortlog[1] ++%ae+:: author email ++%aE+:: author email (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%al':: author email local-part (the part before the '@' sign) -'%aL':: author local-part (see '%al') respecting .mailmap, see ++%al+:: author email local-part (the part before the `@` sign) ++%aL+:: author local-part (see +%al+) respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%ad':: author date (format respects --date= option) -'%aD':: author date, RFC2822 style -'%ar':: author date, relative -'%at':: author date, UNIX timestamp -'%ai':: author date, ISO 8601-like format -'%aI':: author date, strict ISO 8601 format -'%as':: author date, short format (`YYYY-MM-DD`) -'%ah':: author date, human style (like the `--date=human` option of ++%ad+:: author date (format respects --date= option) ++%aD+:: author date, RFC2822 style ++%ar+:: author date, relative ++%at+:: author date, UNIX timestamp ++%ai+:: author date, ISO 8601-like format ++%aI+:: author date, strict ISO 8601 format ++%as+:: author date, short format (`YYYY-MM-DD`) ++%ah+:: author date, human style (like the `--date=human` option of linkgit:git-rev-list[1]) -'%cn':: committer name -'%cN':: committer name (respecting .mailmap, see ++%cn+:: committer name ++%cN+:: committer name (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%ce':: committer email -'%cE':: committer email (respecting .mailmap, see ++%ce+:: committer email ++%cE+:: committer email (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%cl':: committer email local-part (the part before the '@' sign) -'%cL':: committer local-part (see '%cl') respecting .mailmap, see ++%cl+:: committer email local-part (the part before the `@` sign) ++%cL+:: committer local-part (see +%cl+) respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%cd':: committer date (format respects --date= option) -'%cD':: committer date, RFC2822 style -'%cr':: committer date, relative -'%ct':: committer date, UNIX timestamp -'%ci':: committer date, ISO 8601-like format -'%cI':: committer date, strict ISO 8601 format -'%cs':: committer date, short format (`YYYY-MM-DD`) -'%ch':: committer date, human style (like the `--date=human` option of ++%cd+:: committer date (format respects --date= option) ++%cD+:: committer date, RFC2822 style ++%cr+:: committer date, relative ++%ct+:: committer date, UNIX timestamp ++%ci+:: committer date, ISO 8601-like format ++%cI+:: committer date, strict ISO 8601 format ++%cs+:: committer date, short format (`YYYY-MM-DD`) ++%ch+:: committer date, human style (like the `--date=human` option of linkgit:git-rev-list[1]) -'%d':: ref names, like the --decorate option of linkgit:git-log[1] -'%D':: ref names without the " (", ")" wrapping. -'%(decorate[:<options>])':: ++%d+:: ref names, like the --decorate option of linkgit:git-log[1] ++%D+:: ref names without the " (", ")" wrapping. +++%(decorate++`[:<option>,...]`++)++:: ref names with custom decorations. The `decorate` string may be followed by a colon and zero or more comma-separated options. Option values may contain literal formatting codes. These must be used for commas (`%x2C`) and closing parentheses (`%x29`), due to their role in the option syntax. + -** 'prefix=<value>': Shown before the list of ref names. Defaults to "{nbsp}`(`". -** 'suffix=<value>': Shown after the list of ref names. Defaults to "`)`". -** 'separator=<value>': Shown between ref names. Defaults to "`,`{nbsp}". -** 'pointer=<value>': Shown between HEAD and the branch it points to, if any. - Defaults to "{nbsp}`->`{nbsp}". -** 'tag=<value>': Shown before tag names. Defaults to "`tag:`{nbsp}". +** `prefix=<value>`: Shown before the list of ref names. Defaults to "{nbsp}+(+". +** `suffix=<value>`: Shown after the list of ref names. Defaults to "+)+". +** `separator=<value>`: Shown between ref names. Defaults to "+,+{nbsp}". +** `pointer=<value>`: Shown between HEAD and the branch it points to, if any. + Defaults to "{nbsp}+->+{nbsp}". +** `tag=<value>`: Shown before tag names. Defaults to "`tag:`{nbsp}". + For example, to produce decorations with no wrapping or tag annotations, and spaces as separators: + -`%(decorate:prefix=,suffix=,tag=,separator= )` +++%(decorate:prefix=,suffix=,tag=,separator= )++ -'%(describe[:<options>])':: +++%(describe++`[:<option>,...]`++)++:: human-readable name, like linkgit:git-describe[1]; empty string for undescribable commits. The `describe` string may be followed by a colon and zero or more comma-separated options. Descriptions can be inconsistent when tags are added or removed at the same time. + -** 'tags[=<bool-value>]': Instead of only considering annotated tags, +** `tags[=<bool-value>]`: Instead of only considering annotated tags, consider lightweight tags as well. -** 'abbrev=<number>': Instead of using the default number of hexadecimal digits +** `abbrev=<number>`: Instead of using the default number of hexadecimal digits (which will vary according to the number of objects in the repository with a default of 7) of the abbreviated object name, use <number> digits, or as many digits as needed to form a unique object name. -** 'match=<pattern>': Only consider tags matching the given - `glob(7)` pattern, excluding the "refs/tags/" prefix. -** 'exclude=<pattern>': Do not consider tags matching the given - `glob(7)` pattern, excluding the "refs/tags/" prefix. +** `match=<pattern>`: Only consider tags matching the given + `glob(7)` _<pattern>_, excluding the `refs/tags/` prefix. +** `exclude=<pattern>`: Do not consider tags matching the given + `glob(7)` _<pattern>_, excluding the `refs/tags/` prefix. -'%S':: ref name given on the command line by which the commit was reached ++%S+:: ref name given on the command line by which the commit was reached (like `git log --source`), only works with `git log` -'%e':: encoding -'%s':: subject -'%f':: sanitized subject line, suitable for a filename -'%b':: body -'%B':: raw body (unwrapped subject and body) ++%e+:: encoding ++%s+:: subject ++%f+:: sanitized subject line, suitable for a filename ++%b+:: body ++%B+:: raw body (unwrapped subject and body) ifndef::git-rev-list[] -'%N':: commit notes ++%N+:: commit notes endif::git-rev-list[] -'%GG':: raw verification message from GPG for a signed commit -'%G?':: show "G" for a good (valid) signature, ++%GG+:: raw verification message from GPG for a signed commit ++%G?+:: show "G" for a good (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity, "X" for a good signature that has expired, @@ -279,86 +282,86 @@ endif::git-rev-list[] "R" for a good signature made by a revoked key, "E" if the signature cannot be checked (e.g. missing key) and "N" for no signature -'%GS':: show the name of the signer for a signed commit -'%GK':: show the key used to sign a signed commit -'%GF':: show the fingerprint of the key used to sign a signed commit -'%GP':: show the fingerprint of the primary key whose subkey was used ++%GS+:: show the name of the signer for a signed commit ++%GK+:: show the key used to sign a signed commit ++%GF+:: show the fingerprint of the key used to sign a signed commit ++%GP+:: show the fingerprint of the primary key whose subkey was used to sign a signed commit -'%GT':: show the trust level for the key used to sign a signed commit -'%gD':: reflog selector, e.g., `refs/stash@{1}` or `refs/stash@{2 ++%GT+:: show the trust level for the key used to sign a signed commit ++%gD+:: reflog selector, e.g., `refs/stash@{1}` or `refs/stash@{2 minutes ago}`; the format follows the rules described for the `-g` option. The portion before the `@` is the refname as given on the command line (so `git log -g refs/heads/master` would yield `refs/heads/master@{0}`). -'%gd':: shortened reflog selector; same as `%gD`, but the refname ++%gd+:: shortened reflog selector; same as `%gD`, but the refname portion is shortened for human readability (so `refs/heads/master` becomes just `master`). -'%gn':: reflog identity name -'%gN':: reflog identity name (respecting .mailmap, see ++%gn+:: reflog identity name ++%gN+:: reflog identity name (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%ge':: reflog identity email -'%gE':: reflog identity email (respecting .mailmap, see ++%ge+:: reflog identity email ++%gE+:: reflog identity email (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1]) -'%gs':: reflog subject -'%(trailers[:<options>])':: ++%gs+:: reflog subject +++%(trailers++`[:<option>,...]`++)++:: display the trailers of the body as interpreted by linkgit:git-interpret-trailers[1]. The `trailers` string may be followed by a colon and zero or more comma-separated options. If any option is provided multiple times, the last occurrence wins. + -** 'key=<key>': only show trailers with specified <key>. Matching is done +** `key=<key>`: only show trailers with specified <key>. Matching is done case-insensitively and trailing colon is optional. If option is given multiple times trailer lines matching any of the keys are shown. This option automatically enables the `only` option so that non-trailer lines in the trailer block are hidden. If that is not desired it can be disabled with `only=false`. E.g., - `%(trailers:key=Reviewed-by)` shows trailer lines with key + +%(trailers:key=Reviewed-by)+ shows trailer lines with key `Reviewed-by`. -** 'only[=<bool>]': select whether non-trailer lines from the trailer +** `only[=<bool>]`: select whether non-trailer lines from the trailer block should be included. -** 'separator=<sep>': specify the separator inserted between trailer +** `separator=<sep>`: specify the separator inserted between trailer lines. Defaults to a line feed character. The string <sep> may contain the literal formatting codes described above. To use comma as separator one must use `%x2C` as it would otherwise be parsed as - next option. E.g., `%(trailers:key=Ticket,separator=%x2C )` + next option. E.g., +%(trailers:key=Ticket,separator=%x2C )+ shows all trailer lines whose key is "Ticket" separated by a comma and a space. -** 'unfold[=<bool>]': make it behave as if interpret-trailer's `--unfold` +** `unfold[=<bool>]`: make it behave as if interpret-trailer's `--unfold` option was given. E.g., - `%(trailers:only,unfold=true)` unfolds and shows all trailer lines. -** 'keyonly[=<bool>]': only show the key part of the trailer. -** 'valueonly[=<bool>]': only show the value part of the trailer. -** 'key_value_separator=<sep>': specify the separator inserted between + +%(trailers:only,unfold=true)+ unfolds and shows all trailer lines. +** `keyonly[=<bool>]`: only show the key part of the trailer. +** `valueonly[=<bool>]`: only show the value part of the trailer. +** `key_value_separator=<sep>`: specify the separator inserted between the key and value of each trailer. Defaults to ": ". Otherwise it - shares the same semantics as 'separator=<sep>' above. + shares the same semantics as `separator=<sep>` above. NOTE: Some placeholders may depend on other options given to the -revision traversal engine. For example, the `%g*` reflog options will +revision traversal engine. For example, the +%g*+ reflog options will insert an empty string unless we are traversing reflog entries (e.g., by -`git log -g`). The `%d` and `%D` placeholders will use the "short" +`git log -g`). The +%d+ and +%D+ placeholders will use the "short" decoration format if `--decorate` was not already provided on the command line. The boolean options accept an optional value `[=<bool-value>]`. The -values taken by `--type=bool` git-config[1], like `yes` and `off`, +values taken by `--type=bool` linkgit:git-config[1], like `yes` and `off`, are all accepted. Giving a boolean option without `=<value>` is equivalent to giving it with `=true`. -If you add a `+` (plus sign) after '%' of a placeholder, a line-feed +If you add a `+` (plus sign) after +%+ of a placeholder, a line-feed is inserted immediately before the expansion if and only if the placeholder expands to a non-empty string. -If you add a `-` (minus sign) after '%' of a placeholder, all consecutive +If you add a `-` (minus sign) after +%+ of a placeholder, all consecutive line-feeds immediately preceding the expansion are deleted if and only if the placeholder expands to an empty string. -If you add a ` ` (space) after '%' of a placeholder, a space +If you add a `' '` (space) after +%+ of a placeholder, a space is inserted immediately before the expansion if and only if the placeholder expands to a non-empty string. -* 'tformat:' +* `tformat:` + -The 'tformat:' format works exactly like 'format:', except that it +The `tformat:` format works exactly like `format:`, except that it provides "terminator" semantics instead of "separator" semantics. In other words, each commit has the message terminator character (usually a newline) appended, rather than a separator placed between entries. @@ -378,7 +381,7 @@ $ git log -2 --pretty=tformat:%h 4da45bef \ 7134973 --------------------- + -In addition, any unrecognized string that has a `%` in it is interpreted +In addition, any unrecognized string that has a +%+ in it is interpreted as if it has `tformat:` in front of it. For example, these two are equivalent: + diff --git a/Documentation/pretty-options.adoc b/Documentation/pretty-options.adoc index b36e96abe2..8aac51dbe7 100644 --- a/Documentation/pretty-options.adoc +++ b/Documentation/pretty-options.adoc @@ -1,38 +1,38 @@ ---pretty[=<format>]:: ---format=<format>:: +`--pretty[=<format>]`:: +`--format=<format>`:: Pretty-print the contents of the commit logs in a given format, - where '<format>' can be one of 'oneline', 'short', 'medium', - 'full', 'fuller', 'reference', 'email', 'raw', 'format:<string>' - and 'tformat:<string>'. When '<format>' is none of the above, - and has '%placeholder' in it, it acts as if - '--pretty=tformat:<format>' were given. + where '<format>' can be one of `oneline`, `short`, `medium`, + `full`, `fuller`, `reference`, `email`, `raw`, `format:<string>` + and `tformat:<string>`. When _<format>_ is none of the above, + and has `%<placeholder>` in it, it acts as if + `--pretty=tformat:<format>` were given. + See the "PRETTY FORMATS" section for some additional details for each -format. When '=<format>' part is omitted, it defaults to 'medium'. +format. When `=<format>` part is omitted, it defaults to `medium`. + -Note: you can specify the default pretty format in the repository +NOTE: you can specify the default pretty format in the repository configuration (see linkgit:git-config[1]). ---abbrev-commit:: +`--abbrev-commit`:: Instead of showing the full 40-byte hexadecimal commit object name, show a prefix that names the object uniquely. - "--abbrev=<n>" (which also modifies diff output, if it is displayed) + `--abbrev=<n>` (which also modifies diff output, if it is displayed) option can be used to specify the minimum length of the prefix. + -This should make "--pretty=oneline" a whole lot more readable for +This should make `--pretty=oneline` a whole lot more readable for people using 80-column terminals. ---no-abbrev-commit:: +`--no-abbrev-commit`:: Show the full 40-byte hexadecimal commit object name. This negates `--abbrev-commit`, either explicit or implied by other options such - as "--oneline". It also overrides the `log.abbrevCommit` variable. + as `--oneline`. It also overrides the `log.abbrevCommit` variable. ---oneline:: - This is a shorthand for "--pretty=oneline --abbrev-commit" +`--oneline`:: + This is a shorthand for `--pretty=oneline --abbrev-commit` used together. ---encoding=<encoding>:: +`--encoding=<encoding>`:: Commit objects record the character encoding used for the log message in their encoding header; this option can be used to tell the command to re-code the commit log message in the encoding @@ -44,22 +44,22 @@ people using 80-column terminals. to convert the commit, we will quietly output the original object verbatim. ---expand-tabs=<n>:: ---expand-tabs:: ---no-expand-tabs:: +`--expand-tabs=<n>`:: +`--expand-tabs`:: +`--no-expand-tabs`:: Perform a tab expansion (replace each tab with enough spaces - to fill to the next display column that is a multiple of '<n>') + to fill to the next display column that is a multiple of _<n>_) in the log message before showing it in the output. `--expand-tabs` is a short-hand for `--expand-tabs=8`, and `--no-expand-tabs` is a short-hand for `--expand-tabs=0`, which disables tab expansion. + By default, tabs are expanded in pretty formats that indent the log -message by 4 spaces (i.e. 'medium', which is the default, 'full', -and 'fuller'). +message by 4 spaces (i.e. `medium`, which is the default, `full`, +and `fuller`). ifndef::git-rev-list[] ---notes[=<ref>]:: +`--notes[=<ref>]`:: Show the notes (see linkgit:git-notes[1]) that annotate the commit, when showing the commit log message. This is the default ifndef::with-breaking-changes[] @@ -80,28 +80,29 @@ to display. The ref can specify the full refname when it begins with `refs/notes/`; when it begins with `notes/`, `refs/` and otherwise `refs/notes/` is prefixed to form the full name of the ref. + -Multiple --notes options can be combined to control which notes are -being displayed. Examples: "--notes=foo" will show only notes from -"refs/notes/foo"; "--notes=foo --notes" will show both notes from +Multiple `--notes` options can be combined to control which notes are +being displayed. Examples: "`--notes=foo`" will show only notes from +`refs/notes/foo`; "`--notes=foo --notes`" will show both notes from "refs/notes/foo" and from the default notes ref(s). ---no-notes:: +`--no-notes`:: Do not show notes. This negates the above `--notes` option, by resetting the list of notes refs from which notes are shown. Options are parsed in the order given on the command line, so e.g. - "--notes --notes=foo --no-notes --notes=bar" will only show notes - from "refs/notes/bar". + "`--notes --notes=foo --no-notes --notes=bar`" will only show notes + from `refs/notes/bar`. ---show-notes-by-default:: +`--show-notes-by-default`:: Show the default notes unless options for displaying specific notes are given. ---show-notes[=<ref>]:: ---[no-]standard-notes:: - These options are deprecated. Use the above --notes/--no-notes +`--show-notes[=<ref>]`:: +`--standard-notes`:: +`--no-standard-notes`:: + These options are deprecated. Use the above `--notes`/`--no-notes` options instead. endif::git-rev-list[] ---show-signature:: +`--show-signature`:: Check the validity of a signed commit object by passing the signature to `gpg --verify` and show the output. diff --git a/Documentation/rev-list-description.adoc b/Documentation/rev-list-description.adoc index a9efa7fa27..82c680e570 100644 --- a/Documentation/rev-list-description.adoc +++ b/Documentation/rev-list-description.adoc @@ -26,8 +26,8 @@ endif::git-log[] means "list all the commits which are reachable from 'foo' or 'bar', but not from 'baz'". -A special notation "'<commit1>'..'<commit2>'" can be used as a -short-hand for "^'<commit1>' '<commit2>'". For example, either of +A special notation "`<commit1>..<commit2>`" can be used as a +short-hand for "`^<commit1> <commit2>`". For example, either of the following may be used interchangeably: ifdef::git-rev-list[] @@ -43,7 +43,7 @@ $ git log HEAD ^origin ----------------------------------------------------------------------- endif::git-log[] -Another special notation is "'<commit1>'...'<commit2>'" which is useful +Another special notation is "`<commit1>...<commit2>`" which is useful for merges. The resulting set of commits is the symmetric difference between the two operands. The following two commands are equivalent: diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc index ae8765644c..d9665d82c8 100644 --- a/Documentation/rev-list-options.adoc +++ b/Documentation/rev-list-options.adoc @@ -6,60 +6,60 @@ special notations explained in the description, additional commit limiting may be applied. Using more options generally further limits the output (e.g. -`--since=<date1>` limits to commits newer than `<date1>`, and using it +`--since=<date1>` limits to commits newer than _<date1>_, and using it with `--grep=<pattern>` further limits to commits whose log message -has a line that matches `<pattern>`), unless otherwise noted. +has a line that matches _<pattern>_), unless otherwise noted. Note that these are applied before commit ordering and formatting options, such as `--reverse`. --<number>:: --n <number>:: ---max-count=<number>:: - Limit the number of commits to output. +`-<number>`:: +`-n <number>`:: +`--max-count=<number>`:: + Limit the output to _<number>_ commits. ---skip=<number>:: - Skip 'number' commits before starting to show the commit output. +`--skip=<number>`:: + Skip _<number>_ commits before starting to show the commit output. ---since=<date>:: ---after=<date>:: - Show commits more recent than a specific date. +`--since=<date>`:: +`--after=<date>`:: + Show commits more recent than _<date>_. ---since-as-filter=<date>:: - Show all commits more recent than a specific date. This visits +`--since-as-filter=<date>`:: + Show all commits more recent than _<date>_. This visits all commits in the range, rather than stopping at the first commit which - is older than a specific date. + is older than _<date>_. ---until=<date>:: ---before=<date>:: - Show commits older than a specific date. +`--until=<date>`:: +`--before=<date>`:: + Show commits older than _<date>_. ifdef::git-rev-list[] ---max-age=<timestamp>:: ---min-age=<timestamp>:: +`--max-age=<timestamp>`:: +`--min-age=<timestamp>`:: Limit the commits output to specified time range. endif::git-rev-list[] ---author=<pattern>:: ---committer=<pattern>:: +`--author=<pattern>`:: +`--committer=<pattern>`:: Limit the commits output to ones with author/committer - header lines that match the specified pattern (regular - expression). With more than one `--author=<pattern>`, - commits whose author matches any of the given patterns are + header lines that match the _<pattern>_ regular + expression. With more than one `--author=<pattern>`, + commits whose author matches any of the _<pattern>_ are chosen (similarly for multiple `--committer=<pattern>`). ---grep-reflog=<pattern>:: +`--grep-reflog=<pattern>`:: Limit the commits output to ones with reflog entries that - match the specified pattern (regular expression). With + match the _<pattern>_ regular expression. With more than one `--grep-reflog`, commits whose reflog message matches any of the given patterns are chosen. It is an error to use this option unless `--walk-reflogs` is in use. ---grep=<pattern>:: +`--grep=<pattern>`:: Limit the commits output to ones with a log message that - matches the specified pattern (regular expression). With + matches the _<pattern>_ regular expression. With more than one `--grep=<pattern>`, commits whose message - matches any of the given patterns are chosen (but see + matches any of the _<pattern>_ are chosen (but see `--all-match`). ifndef::git-rev-list[] + @@ -67,35 +67,35 @@ When `--notes` is in effect, the message from the notes is matched as if it were part of the log message. endif::git-rev-list[] ---all-match:: +`--all-match`:: Limit the commits output to ones that match all given `--grep`, instead of ones that match at least one. ---invert-grep:: +`--invert-grep`:: Limit the commits output to ones with a log message that do not - match the pattern specified with `--grep=<pattern>`. + match the _<pattern>_ specified with `--grep=<pattern>`. --i:: ---regexp-ignore-case:: +`-i`:: +`--regexp-ignore-case`:: Match the regular expression limiting patterns without regard to letter case. ---basic-regexp:: +`--basic-regexp`:: Consider the limiting patterns to be basic regular expressions; this is the default. --E:: ---extended-regexp:: +`-E`:: +`--extended-regexp`:: Consider the limiting patterns to be extended regular expressions instead of the default basic regular expressions. --F:: ---fixed-strings:: +`-F`:: +`--fixed-strings`:: Consider the limiting patterns to be fixed strings (don't interpret pattern as a regular expression). --P:: ---perl-regexp:: +`-P`:: +`--perl-regexp`:: Consider the limiting patterns to be Perl-compatible regular expressions. + @@ -103,20 +103,20 @@ Support for these types of regular expressions is an optional compile-time dependency. If Git wasn't compiled with support for them providing this option will cause it to die. ---remove-empty:: +`--remove-empty`:: Stop when a given path disappears from the tree. ---merges:: +`--merges`:: Print only merge commits. This is exactly the same as `--min-parents=2`. ---no-merges:: +`--no-merges`:: Do not print commits with more than one parent. This is exactly the same as `--max-parents=1`. ---min-parents=<number>:: ---max-parents=<number>:: ---no-min-parents:: ---no-max-parents:: +`--min-parents=<number>`:: +`--max-parents=<number>`:: +`--no-min-parents`:: +`--no-max-parents`:: Show only commits which have at least (or at most) that many parent commits. In particular, `--max-parents=1` is the same as `--no-merges`, `--min-parents=2` is the same as `--merges`. `--max-parents=0` @@ -126,7 +126,7 @@ providing this option will cause it to die. again. Equivalent forms are `--min-parents=0` (any commit has 0 or more parents) and `--max-parents=-1` (negative numbers denote no upper limit). ---first-parent:: +`--first-parent`:: When finding commits to include, follow only the first parent commit upon seeing a merge commit. This option can give a better overview when viewing the evolution of @@ -141,14 +141,14 @@ This option also changes default diff format for merge commits to `first-parent`, see `--diff-merges=first-parent` for details. endif::git-log[] ---exclude-first-parent-only:: +`--exclude-first-parent-only`:: When finding commits to exclude (with a '{caret}'), follow only the first parent commit upon seeing a merge commit. This can be used to find the set of changes in a topic branch from the point where it diverged from the remote branch, given that arbitrary merges can be valid topic branch changes. ---not:: +`--not`:: Reverses the meaning of the '{caret}' prefix (or lack thereof) for all following revision specifiers, up to the next `--not`. When used on the command line before --stdin, the revisions passed @@ -156,37 +156,37 @@ endif::git-log[] via standard input, the revisions passed on the command line will not be affected by it. ---all:: +`--all`:: Pretend as if all the refs in `refs/`, along with `HEAD`, are - listed on the command line as '<commit>'. + listed on the command line as _<commit>_. ---branches[=<pattern>]:: +`--branches[=<pattern>]`:: Pretend as if all the refs in `refs/heads` are listed - on the command line as '<commit>'. If '<pattern>' is given, limit - branches to ones matching given shell glob. If pattern lacks '?', + on the command line as _<commit>_. If _<pattern>_ is given, limit + branches to ones matching given shell glob. If _<pattern>_ lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied. ---tags[=<pattern>]:: +`--tags[=<pattern>]`:: Pretend as if all the refs in `refs/tags` are listed - on the command line as '<commit>'. If '<pattern>' is given, limit + on the command line as _<commit>_. If _<pattern>_ is given, limit tags to ones matching given shell glob. If pattern lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied. ---remotes[=<pattern>]:: +`--remotes[=<pattern>]`:: Pretend as if all the refs in `refs/remotes` are listed - on the command line as '<commit>'. If '<pattern>' is given, limit + on the command line as _<commit>_. If _<pattern>_ is given, limit remote-tracking branches to ones matching given shell glob. If pattern lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied. ---glob=<glob-pattern>:: - Pretend as if all the refs matching shell glob '<glob-pattern>' - are listed on the command line as '<commit>'. Leading 'refs/', +`--glob=<glob-pattern>`:: + Pretend as if all the refs matching shell glob _<glob-pattern>_ + are listed on the command line as _<commit>_. Leading 'refs/', is automatically prepended if missing. If pattern lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied. ---exclude=<glob-pattern>:: +`--exclude=<glob-pattern>`:: - Do not include refs matching '<glob-pattern>' that the next `--all`, + Do not include refs matching _<glob-pattern>_ that the next `--all`, `--branches`, `--tags`, `--remotes`, or `--glob` would otherwise consider. Repetitions of this option accumulate exclusion patterns up to the next `--all`, `--branches`, `--tags`, `--remotes`, or @@ -199,7 +199,7 @@ respectively, and they must begin with `refs/` when applied to `--glob` or `--all`. If a trailing '/{asterisk}' is intended, it must be given explicitly. ---exclude-hidden=[fetch|receive|uploadpack]:: +`--exclude-hidden=(fetch|receive|uploadpack)`:: Do not include refs that would be hidden by `git-fetch`, `git-receive-pack` or `git-upload-pack` by consulting the appropriate `fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs` @@ -207,11 +207,11 @@ explicitly. linkgit:git-config[1]). This option affects the next pseudo-ref option `--all` or `--glob` and is cleared after processing them. ---reflog:: +`--reflog`:: Pretend as if all objects mentioned by reflogs are listed on the - command line as `<commit>`. + command line as _<commit>_. ---alternate-refs:: +`--alternate-refs`:: Pretend as if all objects mentioned as ref tips of alternate repositories were listed on the command line. An alternate repository is any repository whose object directory is specified @@ -219,7 +219,7 @@ explicitly. be modified by `core.alternateRefsCommand`, etc. See linkgit:git-config[1]. ---single-worktree:: +`--single-worktree`:: By default, all working trees will be examined by the following options when there are more than one (see linkgit:git-worktree[1]): `--all`, `--reflog` and @@ -227,19 +227,19 @@ explicitly. This option forces them to examine the current working tree only. ---ignore-missing:: +`--ignore-missing`:: Upon seeing an invalid object name in the input, pretend as if the bad input was not given. ifndef::git-rev-list[] ---bisect:: +`--bisect`:: Pretend as if the bad bisection ref `refs/bisect/bad` was listed and as if it was followed by `--not` and the good bisection refs `refs/bisect/good-*` on the command line. endif::git-rev-list[] ---stdin:: +`--stdin`:: In addition to getting arguments from the command line, read them from standard input as well. This accepts commits and pseudo-options like `--all` and `--glob=`. When a `--` separator @@ -249,15 +249,15 @@ endif::git-rev-list[] influence any subsequent command line arguments. ifdef::git-rev-list[] ---quiet:: +`--quiet`:: Don't print anything to standard output. This form is primarily meant to allow the caller to test the exit status to see if a range of objects is fully connected (or not). It is faster than redirecting stdout to `/dev/null` as the output does not have to be formatted. ---disk-usage:: ---disk-usage=human:: +`--disk-usage`:: +`--disk-usage=human`:: Suppress normal output; instead, print the sum of the bytes used for on-disk storage by the selected commits or objects. This is equivalent to piping the output into `git cat-file @@ -269,11 +269,11 @@ ifdef::git-rev-list[] in human-readable string(e.g. 12.24 Kib, 3.50 Mib). endif::git-rev-list[] ---cherry-mark:: +`--cherry-mark`:: Like `--cherry-pick` (see below) but mark equivalent commits with `=` rather than omitting them, and inequivalent ones with `+`. ---cherry-pick:: +`--cherry-pick`:: Omit any commit that introduces the same change as another commit on the ``other side'' when the set of commits are limited with symmetric difference. @@ -286,8 +286,8 @@ cherry-picked from the other branch (for example, ``3rd on b'' may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output. ---left-only:: ---right-only:: +`--left-only`:: +`--right-only`:: List only commits on the respective side of a symmetric difference, i.e. only those which would be marked `<` resp. `>` by `--left-right`. @@ -298,20 +298,20 @@ commits from `B` which are in `A` or are patch-equivalent to a commit in More precisely, `--cherry-pick --right-only --no-merges` gives the exact list. ---cherry:: +`--cherry`:: A synonym for `--right-only --cherry-mark --no-merges`; useful to limit the output to the commits on our side and mark those that have been applied to the other side of a forked history with `git log --cherry upstream...mybranch`, similar to `git cherry upstream mybranch`. --g:: ---walk-reflogs:: +`-g`:: +`--walk-reflogs`:: Instead of walking the commit ancestry chain, walk reflog entries from the most recent one to older ones. When this option is used you cannot specify commits to - exclude (that is, '{caret}commit', 'commit1..commit2', - and 'commit1\...commit2' notations cannot be used). + exclude (that is, `^<commit>`, `<commit1>..<commit2>`, + and `<commit1>...<commit2>` notations cannot be used). + With `--pretty` format other than `oneline` and `reference` (for obvious reasons), this causes the output to have two extra lines of information @@ -340,29 +340,29 @@ See also linkgit:git-reflog[1]. + Under `--pretty=reference`, this information will not be shown at all. ---merge:: +`--merge`:: Show commits touching conflicted paths in the range `HEAD...<other>`, where `<other>` is the first existing pseudoref in `MERGE_HEAD`, `CHERRY_PICK_HEAD`, `REVERT_HEAD` or `REBASE_HEAD`. Only works when the index has unmerged entries. This option can be used to show relevant commits when resolving conflicts from a 3-way merge. ---boundary:: +`--boundary`:: Output excluded boundary commits. Boundary commits are prefixed with `-`. ifdef::git-rev-list[] ---use-bitmap-index:: +`--use-bitmap-index`:: Try to speed up the traversal using the pack bitmap index (if one is available). Note that when traversing with `--objects`, trees and blobs will not have their associated path printed. ---progress=<header>:: +`--progress=<header>`:: Show progress reports on stderr as objects are considered. The `<header>` text will be printed with each progress update. --z:: +`-z`:: Instead of being newline-delimited, each outputted object and its accompanying metadata is delimited using NUL bytes. Output is printed in the following form: @@ -397,56 +397,56 @@ is how to do it, as there are various strategies to simplify the history. The following options select the commits to be shown: -<paths>:: +`<paths>`:: Commits modifying the given <paths> are selected. ---simplify-by-decoration:: +`--simplify-by-decoration`:: Commits that are referred by some branch or tag are selected. Note that extra commits can be shown to give a meaningful history. The following options affect the way the simplification is performed: -Default mode:: +`Default mode`:: Simplifies the history to the simplest history explaining the final state of the tree. Simplest because it prunes some side branches if the end result is the same (i.e. merging branches with the same content) ---show-pulls:: +`--show-pulls`:: Include all commits from the default mode, but also any merge commits that are not TREESAME to the first parent but are TREESAME to a later parent. This mode is helpful for showing the merge commits that "first introduced" a change to a branch. ---full-history:: +`--full-history`:: Same as the default mode, but does not prune some history. ---dense:: +`--dense`:: Only the selected commits are shown, plus some to have a meaningful history. ---sparse:: +`--sparse`:: All commits in the simplified history are shown. ---simplify-merges:: +`--simplify-merges`:: Additional option to `--full-history` to remove some needless merges from the resulting history, as there are no selected commits contributing to this merge. ---ancestry-path[=<commit>]:: - When given a range of commits to display (e.g. 'commit1..commit2' - or 'commit2 {caret}commit1'), and a commit <commit> in that range, +`--ancestry-path[=<commit>]`:: + When given a range of commits to display (e.g. `<commit1>..<commit2>` + or `<commit2> ^<commit1>`), and a commit _<commit>_ in that range, only display commits in that range - that are ancestors of <commit>, descendants of <commit>, or - <commit> itself. If no commit is specified, use 'commit1' (the - excluded part of the range) as <commit>. Can be passed multiple + that are ancestors of _<commit>_, descendants of _<commit>_, or + _<commit>_ itself. If no commit is specified, use _<commit1>_ (the + excluded part of the range) as _<commit>_. Can be passed multiple times; if so, a commit is included if it is any of the commits given or if it is an ancestor or descendant of one of them. A more detailed explanation follows. -Suppose you specified `foo` as the <paths>. We shall call commits +Suppose you specified `foo` as the _<paths>_. We shall call commits that modify `foo` !TREESAME, and the rest TREESAME. (In a diff filtered for `foo`, they look different and equal, respectively.) @@ -466,22 +466,22 @@ The horizontal line of history A---Q is taken to be the first parent of each merge. The commits are: * `I` is the initial commit, in which `foo` exists with contents - ``asdf'', and a file `quux` exists with contents ``quux''. Initial + `asdf`, and a file `quux` exists with contents `quux`. Initial commits are compared to an empty tree, so `I` is !TREESAME. -* In `A`, `foo` contains just ``foo''. +* In `A`, `foo` contains just `foo`. * `B` contains the same change as `A`. Its merge `M` is trivial and hence TREESAME to all parents. -* `C` does not change `foo`, but its merge `N` changes it to ``foobar'', +* `C` does not change `foo`, but its merge `N` changes it to `foobar`, so it is not TREESAME to any parent. -* `D` sets `foo` to ``baz''. Its merge `O` combines the strings from - `N` and `D` to ``foobarbaz''; i.e., it is not TREESAME to any parent. +* `D` sets `foo` to `baz`. Its merge `O` combines the strings from + `N` and `D` to `foobarbaz`; i.e., it is not TREESAME to any parent. -* `E` changes `quux` to ``xyzzy'', and its merge `P` combines the - strings to ``quux xyzzy''. `P` is TREESAME to `O`, but not to `E`. +* `E` changes `quux` to `xyzzy`, and its merge `P` combines the + strings to `quux xyzzy`. `P` is TREESAME to `O`, but not to `E`. * `X` is an independent root commit that added a new file `side`, and `Y` modified it. `Y` is TREESAME to `X`. Its merge `Q` added `side` to `P`, and @@ -517,7 +517,7 @@ Parent/child relations are only visible with `--parents`, but that does not affect the commits selected in default mode, so we have shown the parent lines. ---full-history without parent rewriting:: +`--full-history` without parent rewriting:: This mode differs from the default in one point: always follow all parents of a merge, even if it is TREESAME to one of them. Even if more than one side of the merge has commits that are @@ -536,7 +536,7 @@ Note that without parent rewriting, it is not really possible to talk about the parent/child relationships between the commits, so we show them disconnected. ---full-history with parent rewriting:: +`--full-history` with parent rewriting:: Ordinary commits are only included if they are !TREESAME (though this can be changed, see `--sparse` below). + @@ -560,18 +560,18 @@ rewritten to contain `E`'s parent `I`. The same happened for `C` and In addition to the above settings, you can change whether TREESAME affects inclusion: ---dense:: +`--dense`:: Commits that are walked are included if they are not TREESAME to any parent. ---sparse:: +`--sparse`:: All commits that are walked are included. + Note that without `--full-history`, this still simplifies merges: if one of the parents is TREESAME, we follow only that one, so the other sides of the merge are never walked. ---simplify-merges:: +`--simplify-merges`:: First, build a history graph in the same way that `--full-history` with parent rewriting does (see above). + @@ -618,9 +618,9 @@ Note the major differences in `N`, `P`, and `Q` over `--full-history`: There is another simplification mode available: ---ancestry-path[=<commit>]:: +`--ancestry-path[=<commit>]`:: Limit the displayed commits to those which are an ancestor of - <commit>, or which are a descendant of <commit>, or are <commit> + _<commit>_, or which are a descendant of _<commit>_, or are _<commit>_ itself. + As an example use case, consider the following commit history: @@ -636,15 +636,15 @@ As an example use case, consider the following commit history: A regular 'D..M' computes the set of commits that are ancestors of `M`, but excludes the ones that are ancestors of `D`. This is useful to see what happened to the history leading to `M` since `D`, in the sense -that ``what does `M` have that did not exist in `D`''. The result in this +that "what does `M` have that did not exist in `D`". The result in this example would be all the commits, except `A` and `B` (and `D` itself, of course). + When we want to find out what commits in `M` are contaminated with the bug introduced by `D` and need fixing, however, we might want to view -only the subset of 'D..M' that are actually descendants of `D`, i.e. +only the subset of `D..M` that are actually descendants of `D`, i.e. excluding `C` and `K`. This is exactly what the `--ancestry-path` -option does. Applied to the 'D..M' range, it results in: +option does. Applied to the `D..M` range, it results in: + ----------------------------------------------------------------------- E-------F @@ -655,7 +655,7 @@ option does. Applied to the 'D..M' range, it results in: ----------------------------------------------------------------------- + We can also use `--ancestry-path=D` instead of `--ancestry-path` which -means the same thing when applied to the 'D..M' range but is just more +means the same thing when applied to the `D..M` range but is just more explicit. + If we instead are interested in a given topic within this range, and all @@ -770,7 +770,7 @@ into the important branch. This commit may have information about why the change `X` came to override the changes from `A` and `B` in its commit message. ---show-pulls:: +`--show-pulls`:: In addition to the commits shown in the default history, show each merge commit that is not TREESAME to its first parent but is TREESAME to a later parent. @@ -819,7 +819,7 @@ ifdef::git-rev-list[] Bisection Helpers ~~~~~~~~~~~~~~~~~ ---bisect:: +`--bisect`:: Limit output to the one commit object which is roughly halfway between included and excluded commits. Note that the bad bisection ref `refs/bisect/bad` is added to the included commits (if it @@ -843,7 +843,7 @@ introduces a regression is thus reduced to a binary search: repeatedly generate and test new 'midpoint's until the commit chain is of length one. ---bisect-vars:: +`--bisect-vars`:: This calculates the same as `--bisect`, except that refs in `refs/bisect/` are not used, and except that this outputs text ready to be eval'ed by the shell. These lines will assign the @@ -855,7 +855,7 @@ one. `bisect_bad`, and the number of commits we are bisecting right now to `bisect_all`. ---bisect-all:: +`--bisect-all`:: This outputs all the commit objects between the included and excluded commits, ordered by their distance to the included and excluded commits. Refs in `refs/bisect/` are not used. The farthest @@ -878,15 +878,15 @@ Commit Ordering By default, the commits are shown in reverse chronological order. ---date-order:: +`--date-order`:: Show no parents before all of its children are shown, but otherwise show commits in the commit timestamp order. ---author-date-order:: +`--author-date-order`:: Show no parents before all of its children are shown, but otherwise show commits in the author timestamp order. ---topo-order:: +`--topo-order`:: Show no parents before all of its children are shown, and avoid showing commits on multiple lines of history intermixed. @@ -910,8 +910,8 @@ With `--topo-order`, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5 avoid showing the commits from two parallel development track mixed together. ---reverse:: - Output the commits chosen to be shown (see Commit Limiting +`--reverse`:: + Output the commits chosen to be shown (see 'Commit Limiting' section above) in reverse order. Cannot be combined with `--walk-reflogs`. endif::git-shortlog[] @@ -923,39 +923,39 @@ Object Traversal These options are mostly targeted for packing of Git repositories. ifdef::git-rev-list[] ---objects:: +`--objects`:: Print the object IDs of any object referenced by the listed - commits. `--objects foo ^bar` thus means ``send me + 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_''. See also `--object-names` below. + object `bar` but not `foo`". See also `--object-names` below. ---in-commit-order:: +`--in-commit-order`:: Print tree and blob ids in order of the commits. The tree and blob ids are printed after they are first referenced by a commit. ---objects-edge:: +`--objects-edge`:: Similar to `--objects`, but also print the IDs of excluded - commits prefixed with a ``-'' character. This is used by + commits prefixed with a "`-`" character. This is used by linkgit:git-pack-objects[1] to build a ``thin'' pack, which records objects in deltified form based on objects contained in these excluded commits to reduce network traffic. ---objects-edge-aggressive:: +`--objects-edge-aggressive`:: Similar to `--objects-edge`, but it tries harder to find excluded commits at the cost of increased time. This is used instead of `--objects-edge` to build ``thin'' packs for shallow repositories. ---indexed-objects:: +`--indexed-objects`:: Pretend as if all trees and blobs used by the index are listed on the command line. Note that you probably want to use `--objects`, too. ---unpacked:: +`--unpacked`:: Only useful with `--objects`; print the object IDs that are not in packs. ---object-names:: +`--object-names`:: Only useful with `--objects`; print the names of the object IDs that are found. This is the default behavior. Note that the "name" of each object is ambiguous, and mostly intended as a @@ -964,52 +964,52 @@ ifdef::git-rev-list[] to remove newlines; and if an object would appear multiple times with different names, only one name is shown. ---no-object-names:: +`--no-object-names`:: Only useful with `--objects`; does not print the names of the object IDs that are found. This inverts `--object-names`. This flag allows the output to be more easily parsed by commands such as linkgit:git-cat-file[1]. ---filter=<filter-spec>:: +`--filter=<filter-spec>`:: Only useful with one of the `--objects*`; omits objects (usually - blobs) from the list of printed objects. The '<filter-spec>' + blobs) from the list of printed objects. The _<filter-spec>_ may be one of the following: + -The form '--filter=blob:none' omits all blobs. +The form `--filter=blob:none` omits all blobs. + -The form '--filter=blob:limit=<n>[kmg]' omits blobs of size at least n -bytes or units. n may be zero. The suffixes k, m, and g can be used -to name units in KiB, MiB, or GiB. For example, 'blob:limit=1k' +The form `--filter=blob:limit=<n>[kmg]` omits blobs of size at least _<n>_ +bytes or units. _<n>_ may be zero. The suffixes `k`, `m`, and `g` can be used +to name units in KiB, MiB, or GiB. For example, `blob:limit=1k` is the same as 'blob:limit=1024'. + -The form '--filter=object:type=(tag|commit|tree|blob)' omits all objects +The form `--filter=object:type=(tag|commit|tree|blob)` omits all objects which are not of the requested type. + -The form '--filter=sparse:oid=<blob-ish>' uses a sparse-checkout -specification contained in the blob (or blob-expression) '<blob-ish>' +The form `--filter=sparse:oid=<blob-ish>` uses a sparse-checkout +specification contained in the blob (or blob-expression) _<blob-ish>_ to omit blobs that would not be required for a sparse checkout on the requested refs. + -The form '--filter=tree:<depth>' omits all blobs and trees whose depth -from the root tree is >= <depth> (minimum depth if an object is located -at multiple depths in the commits traversed). <depth>=0 will not include +The form `--filter=tree:<depth>` omits all blobs and trees whose depth +from the root tree is >= _<depth>_ (minimum depth if an object is located +at multiple depths in the commits traversed). _<depth>_=0 will not include any trees or blobs unless included explicitly in the command-line (or -standard input when --stdin is used). <depth>=1 will include only the +standard input when `--stdin` is used). _<depth>_=1 will include only the tree and blobs which are referenced directly by a commit reachable from -<commit> or an explicitly-given object. <depth>=2 is like <depth>=1 +_<commit>_ or an explicitly-given object. _<depth>_=2 is like <depth>=1 while also including trees and blobs one more level removed from an explicitly-given commit or tree. + -Note that the form '--filter=sparse:path=<path>' that wants to read +Note that the form `--filter=sparse:path=<path>` that wants to read from an arbitrary path on the filesystem has been dropped for security reasons. + -Multiple '--filter=' flags can be specified to combine filters. Only +Multiple `--filter=` flags can be specified to combine filters. Only objects which are accepted by every filter are included. + -The form '--filter=combine:<filter1>+<filter2>+...<filterN>' can also be +The form `--filter=combine:<filter1>+<filter2>+...<filterN>` can also be used to combined several filters, but this is harder than just repeating -the '--filter' flag and is usually not necessary. Filters are joined by +the `--filter` flag and is usually not necessary. Filters are joined by '{plus}' and individual filters are %-encoded (i.e. URL-encoded). Besides the '{plus}' and '%' characters, the following characters are reserved and also must be encoded: `~!@#$^&*()[]{}\;",<>?`+'`+ @@ -1017,52 +1017,52 @@ as well as all characters with ASCII code <= `0x20`, which includes space and newline. + Other arbitrary characters can also be encoded. For instance, -'combine:tree:3+blob:none' and 'combine:tree%3A3+blob%3Anone' are +`combine:tree:3+blob:none` and `combine:tree%3A3+blob%3Anone` are equivalent. ---no-filter:: +`--no-filter`:: Turn off any previous `--filter=` argument. ---filter-provided-objects:: +`--filter-provided-objects`:: Filter the list of explicitly provided objects, which would otherwise always be printed even if they did not match any of the filters. Only useful with `--filter=`. ---filter-print-omitted:: +`--filter-print-omitted`:: Only useful with `--filter=`; prints a list of the objects omitted by the filter. Object IDs are prefixed with a ``~'' character. ---missing=<missing-action>:: +`--missing=<missing-action>`:: A debug option to help with future "partial clone" development. This option specifies how missing objects are handled. + -The form '--missing=error' requests that rev-list stop with an error if +The form `--missing=error` requests that rev-list stop with an error if a missing object is encountered. This is the default action. + -The form '--missing=allow-any' will allow object traversal to continue +The form `--missing=allow-any` will allow object traversal to continue if a missing object is encountered. Missing objects will silently be omitted from the results. + -The form '--missing=allow-promisor' is like 'allow-any', but will only +The form `--missing=allow-promisor` is like `allow-any`, but will only allow object traversal to continue for EXPECTED promisor missing objects. Unexpected missing objects will raise an error. + -The form '--missing=print' is like 'allow-any', but will also print a +The form `--missing=print` is like `allow-any`, but will also print a list of the missing objects. Object IDs are prefixed with a ``?'' character. + -The form '--missing=print-info' is like 'print', but will also print additional +The form `--missing=print-info` is like `print`, but will also print additional information about the missing object inferred from its containing object. The information is all printed on the same line with the missing object ID in the form: `?<oid> [<token>=<value>]...`. The `<token>=<value>` pairs containing -additional information are separated from each other by a SP. The value is -encoded in a token specific fashion, but SP or LF contained in value are always +additional information are separated from each other by a _SP_. The value is +encoded in a token specific fashion, but _SP_ or _LF_ contained in value are always expected to be represented in such a way that the resulting encoded value does not have either of these two problematic bytes. Each `<token>=<value>` may be one of the following: + -- * The `path=<path>` shows the path of the missing object inferred from a - containing object. A path containing SP or special characters is enclosed in + containing object. A path containing _SP_ or special characters is enclosed in double-quotes in the C style as needed. + * The `type=<type>` shows the type of the missing object inferred from a @@ -1073,7 +1073,7 @@ If some tips passed to the traversal are missing, they will be considered as missing too, and the traversal will ignore them. In case we cannot get their Object ID though, an error will be raised. ---exclude-promisor-objects:: +`--exclude-promisor-objects`:: (For internal use only.) Prefilter object traversal at promisor boundary. This is used with partial clone. This is stronger than `--missing=allow-promisor` because it limits the @@ -1081,7 +1081,7 @@ we cannot get their Object ID though, an error will be raised. objects. endif::git-rev-list[] ---no-walk[=(sorted|unsorted)]:: +`--no-walk[=(sorted|unsorted)]`:: Only show the given commits, but do not traverse their ancestors. This has no effect if a range is specified. If the argument `unsorted` is given, the commits are shown in the order they were @@ -1090,7 +1090,7 @@ endif::git-rev-list[] by commit time. Cannot be combined with `--graph`. ---do-walk:: +`--do-walk`:: Overrides a previous `--no-walk`. endif::git-shortlog[] @@ -1111,10 +1111,10 @@ endif::git-rev-list[] include::pretty-options.adoc[] ---relative-date:: +`--relative-date`:: Synonym for `--date=relative`. ---date=<format>:: +`--date=<format>`:: Only takes effect for dates shown in human-readable format, such as when using `--pretty`. `log.date` config variable sets a default value for the log command's `--date` option. By default, dates @@ -1164,12 +1164,12 @@ omitted. 1970). As with `--raw`, this is always in UTC and therefore `-local` has no effect. -`--date=format:...` feeds the format `...` to your system `strftime`, -except for %s, %z, and %Z, which are handled internally. +`--date=format:<format>` feeds the _<format>_ to your system `strftime`, +except for `%s`, `%z`, and `%Z`, which are handled internally. Use `--date=format:%c` to show the date in your system locale's -preferred format. See the `strftime` manual for a complete list of +preferred format. See the `strftime`(3) manual for a complete list of format placeholders. When using `-local`, the correct syntax is -`--date=format-local:...`. +`--date=format-local:<format>`. `--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, @@ -1179,33 +1179,33 @@ the local time zone is used, e.g. `Thu Jan 1 00:00:00 1970 +0000`. -- ifdef::git-rev-list[] ---header:: +`--header`:: Print the contents of the commit in raw-format; each record is separated with a NUL character. ---no-commit-header:: +`--no-commit-header`:: Suppress the header line containing "commit" and the object ID printed before the specified format. This has no effect on the built-in formats; only custom formats are affected. ---commit-header:: +`--commit-header`:: Overrides a previous `--no-commit-header`. endif::git-rev-list[] ---parents:: +`--parents`:: Print also the parents of the commit (in the form "commit parent..."). Also enables parent rewriting, see 'History Simplification' above. ---children:: +`--children`:: Print also the children of the commit (in the form "commit child..."). Also enables parent rewriting, see 'History Simplification' above. ifdef::git-rev-list[] ---timestamp:: +`--timestamp`:: Print the raw commit timestamp. endif::git-rev-list[] ---left-right:: +`--left-right`:: Mark which side of a symmetric difference a commit is reachable from. Commits from the left side are prefixed with `<` and those from the right with `>`. If combined with `--boundary`, those @@ -1234,7 +1234,7 @@ you would get an output like this: -xxxxxxx... 1st on a ----------------------------------------------------------------------- ---graph:: +`--graph`:: Draw a text-based graphical representation of the commit history on the left hand side of the output. This may cause extra lines to be printed in between commits, in order for the graph history @@ -1246,15 +1246,15 @@ This enables parent rewriting, see 'History Simplification' above. This implies the `--topo-order` option by default, but the `--date-order` option may also be specified. ---show-linear-break[=<barrier>]:: - When --graph is not used, all history branches are flattened +`--show-linear-break[=<barrier>]`:: + When `--graph` is not used, all history branches are flattened which can make it hard to see that the two consecutive commits do not belong to a linear branch. This option puts a barrier - in between them in that case. If `<barrier>` is specified, it + in between them in that case. If _<barrier>_ is specified, it is the string that will be shown instead of the default one. ifdef::git-rev-list[] ---count:: +`--count`:: Print a number stating how many commits would have been listed, and suppress all other output. When used together with `--left-right`, instead print the counts for left and @@ -114,8 +114,6 @@ include shared.mak # # Define NO_INTPTR_T if you don't have intptr_t or uintptr_t. # -# Define NO_UINTMAX_T if you don't have uintmax_t. -# # Define NEEDS_SOCKET if linking with libc is not enough (SunOS, # Patrick Mauritz). # @@ -1367,6 +1365,7 @@ CLAR_TEST_SUITES += u-prio-queue CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset +CLAR_TEST_SUITES += u-string-list CLAR_TEST_SUITES += u-strvec CLAR_TEST_SUITES += u-trailer CLAR_TEST_SUITES += u-urlmatch-normalization @@ -1918,9 +1917,6 @@ endif ifdef NO_INTPTR_T COMPAT_CFLAGS += -DNO_INTPTR_T endif -ifdef NO_UINTMAX_T - BASIC_CFLAGS += -Duintmax_t=uint32_t -endif ifdef NO_SOCKADDR_STORAGE ifdef NO_IPV6 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in @@ -3473,11 +3469,14 @@ endif coccicheck-test: $(COCCI_TEST_RES_GEN) coccicheck: coccicheck-test + ifdef SPATCH_CONCAT_COCCI -coccicheck: contrib/coccinelle/ALL.cocci.patch +COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = contrib/coccinelle/ALL.cocci.patch else -coccicheck: $(COCCICHECK_PATCHES_INTREE) +COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE) endif +coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) + ! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null # See contrib/coccinelle/README coccicheck-pending: coccicheck-test @@ -4565,7 +4565,7 @@ static int create_file(struct apply_state *state, struct patch *patch) if (patch->conflicted_threeway) return add_conflicted_stages_file(state, patch); - else if (state->update_index) + else if (state->check_index || (state->ita_only && patch->is_new > 0)) return add_index_file(state, path, mode, buf, size); return 0; } @@ -4833,7 +4833,7 @@ static int apply_patch(struct apply_state *state, LOCK_DIE_ON_ERROR); } - if (state->check_index && read_apply_cache(state) < 0) { + if ((state->check_index || state->update_index) && read_apply_cache(state) < 0) { error(_("unable to read index file")); res = -128; goto end; @@ -1311,7 +1311,7 @@ static void add_bloom_key(struct blame_bloom_data *bd, } bd->keys[bd->nr] = xmalloc(sizeof(struct bloom_key)); - fill_bloom_key(path, strlen(path), bd->keys[bd->nr], bd->settings); + bloom_key_fill(bd->keys[bd->nr], path, strlen(path), bd->settings); bd->nr++; } @@ -107,7 +107,7 @@ int load_bloom_filter_from_graph(struct commit_graph *g, * Not considered to be cryptographically secure. * Implemented as described in https://en.wikipedia.org/wiki/MurmurHash#Algorithm */ -uint32_t murmur3_seeded_v2(uint32_t seed, const char *data, size_t len) +static uint32_t murmur3_seeded_v2(uint32_t seed, const char *data, size_t len) { const uint32_t c1 = 0xcc9e2d51; const uint32_t c2 = 0x1b873593; @@ -221,9 +221,7 @@ static uint32_t murmur3_seeded_v1(uint32_t seed, const char *data, size_t len) return seed; } -void fill_bloom_key(const char *data, - size_t len, - struct bloom_key *key, +void bloom_key_fill(struct bloom_key *key, const char *data, size_t len, const struct bloom_filter_settings *settings) { int i; @@ -243,7 +241,7 @@ void fill_bloom_key(const char *data, key->hashes[i] = hash0 + i * hash1; } -void clear_bloom_key(struct bloom_key *key) +void bloom_key_clear(struct bloom_key *key) { FREE_AND_NULL(key->hashes); } @@ -280,6 +278,55 @@ void deinit_bloom_filters(void) deep_clear_bloom_filter_slab(&bloom_filters, free_one_bloom_filter); } +struct bloom_keyvec *bloom_keyvec_new(const char *path, size_t len, + const struct bloom_filter_settings *settings) +{ + struct bloom_keyvec *vec; + const char *p; + size_t sz; + size_t nr = 1; + + p = path; + while (*p) { + /* + * At this point, the path is normalized to use Unix-style + * path separators. This is required due to how the + * changed-path Bloom filters store the paths. + */ + if (*p == '/') + nr++; + p++; + } + + sz = sizeof(struct bloom_keyvec); + sz += nr * sizeof(struct bloom_key); + vec = (struct bloom_keyvec *)xcalloc(1, sz); + if (!vec) + return NULL; + vec->count = nr; + + bloom_key_fill(&vec->key[0], path, len, settings); + nr = 1; + p = path + len - 1; + while (p > path) { + if (*p == '/') { + bloom_key_fill(&vec->key[nr++], path, p - path, settings); + } + p--; + } + assert(nr == vec->count); + return vec; +} + +void bloom_keyvec_free(struct bloom_keyvec *vec) +{ + if (!vec) + return; + for (size_t nr = 0; nr < vec->count; nr++) + bloom_key_clear(&vec->key[nr]); + free(vec); +} + static int pathmap_cmp(const void *hashmap_cmp_fn_data UNUSED, const struct hashmap_entry *eptr, const struct hashmap_entry *entry_or_key, @@ -500,9 +547,9 @@ struct bloom_filter *get_or_compute_bloom_filter(struct repository *r, hashmap_for_each_entry(&pathmap, &iter, e, entry) { struct bloom_key key; - fill_bloom_key(e->path, strlen(e->path), &key, settings); + bloom_key_fill(&key, e->path, strlen(e->path), settings); add_key_to_filter(&key, filter, settings); - clear_bloom_key(&key); + bloom_key_clear(&key); } cleanup: @@ -540,3 +587,26 @@ int bloom_filter_contains(const struct bloom_filter *filter, return 1; } + +int bloom_filter_contains_vec(const struct bloom_filter *filter, + const struct bloom_keyvec *vec, + const struct bloom_filter_settings *settings) +{ + int ret = 1; + + for (size_t nr = 0; ret > 0 && nr < vec->count; nr++) + ret = bloom_filter_contains(filter, &vec->key[nr], settings); + + return ret; +} + +uint32_t test_bloom_murmur3_seeded(uint32_t seed, const char *data, size_t len, + int version) +{ + assert(version == 1 || version == 2); + + if (version == 2) + return murmur3_seeded_v2(seed, data, len); + else + return murmur3_seeded_v1(seed, data, len); +} @@ -74,24 +74,40 @@ struct bloom_key { uint32_t *hashes; }; +/* + * A bloom_keyvec is a vector of bloom_keys, which + * can be used to store multiple keys for a single + * pathspec item. + */ +struct bloom_keyvec { + size_t count; + struct bloom_key key[FLEX_ARRAY]; +}; + int load_bloom_filter_from_graph(struct commit_graph *g, struct bloom_filter *filter, uint32_t graph_pos); +void bloom_key_fill(struct bloom_key *key, const char *data, size_t len, + const struct bloom_filter_settings *settings); +void bloom_key_clear(struct bloom_key *key); + /* - * Calculate the murmur3 32-bit hash value for the given data - * using the given seed. - * Produces a uniformly distributed hash value. - * Not considered to be cryptographically secure. - * Implemented as described in https://en.wikipedia.org/wiki/MurmurHash#Algorithm + * bloom_keyvec_new - Allocate and populate a bloom_keyvec with keys for the + * given path. + * + * This function splits the input path by '/' and generates a bloom key for each + * prefix, in reverse order of specificity. For example, given the input + * "a/b/c", it will generate bloom keys for: + * - "a/b/c" + * - "a/b" + * - "a" + * + * The resulting keys are stored in a newly allocated bloom_keyvec. */ -uint32_t murmur3_seeded_v2(uint32_t seed, const char *data, size_t len); - -void fill_bloom_key(const char *data, - size_t len, - struct bloom_key *key, - const struct bloom_filter_settings *settings); -void clear_bloom_key(struct bloom_key *key); +struct bloom_keyvec *bloom_keyvec_new(const char *path, size_t len, + const struct bloom_filter_settings *settings); +void bloom_keyvec_free(struct bloom_keyvec *vec); void add_key_to_filter(const struct bloom_key *key, struct bloom_filter *filter, @@ -137,4 +153,18 @@ int bloom_filter_contains(const struct bloom_filter *filter, const struct bloom_key *key, const struct bloom_filter_settings *settings); +/* + * bloom_filter_contains_vec - Check if all keys in a key vector are in the + * Bloom filter. + * + * Returns 1 if **all** keys in the vector are present in the filter, + * 0 if **any** key is not present. + */ +int bloom_filter_contains_vec(const struct bloom_filter *filter, + const struct bloom_keyvec *v, + const struct bloom_filter_settings *settings); + +uint32_t test_bloom_murmur3_seeded(uint32_t seed, const char *data, size_t len, + int version); + #endif diff --git a/builtin/am.c b/builtin/am.c index a800003340..c9d925f7b9 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2406,6 +2406,7 @@ int cmd_am(int argc, .type = OPTION_CALLBACK, .long_name = "show-current-patch", .value = &resume_mode, + .precision = sizeof(resume_mode), .argh = "(diff|raw)", .help = N_("show the patch being applied"), .flags = PARSE_OPT_CMDMODE | PARSE_OPT_OPTARG | PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP, diff --git a/builtin/apply.c b/builtin/apply.c index a1e20c593d..d642a40251 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -29,7 +29,7 @@ int cmd_apply(int argc, * cf. https://lore.kernel.org/git/xmqqcypfcmn4.fsf@gitster.g/ */ if (!the_hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); argc = apply_parse_options(argc, argv, &state, &force_apply, &options, diff --git a/builtin/commit.c b/builtin/commit.c index fba0dded64..63e7158e98 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -688,6 +688,10 @@ static void adjust_comment_line_char(const struct strbuf *sb) char candidates[] = "#;@!$%^&|:"; char *candidate; const char *p; + size_t cutoff; + + /* Ignore comment chars in trailing comments (e.g., Conflicts:) */ + cutoff = sb->len - ignored_log_message_bytes(sb->buf, sb->len); if (!memchr(sb->buf, candidates[0], sb->len)) { free(comment_line_str_to_free); @@ -700,7 +704,7 @@ static void adjust_comment_line_char(const struct strbuf *sb) candidate = strchr(candidates, *p); if (candidate) *candidate = ' '; - for (p = sb->buf; *p; p++) { + for (p = sb->buf; p + 1 < sb->buf + cutoff; p++) { if ((p[0] == '\n' || p[0] == '\r') && p[1]) { candidate = strchr(candidates, p[1]); if (candidate) diff --git a/builtin/config.c b/builtin/config.c index f70d635477..5efe273010 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -17,9 +17,9 @@ static const char *const builtin_config_usage[] = { N_("git config list [<file-option>] [<display-option>] [--includes]"), - N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>"), - N_("git config set [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>"), - N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>"), + N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<pattern>] [--fixed-value] [--default=<default>] [--url=<url>] <name>"), + N_("git config set [<file-option>] [--type=<type>] [--all] [--value=<pattern>] [--fixed-value] <name> <value>"), + N_("git config unset [<file-option>] [--all] [--value=<pattern>] [--fixed-value] <name>"), N_("git config rename-section [<file-option>] <old-name> <new-name>"), N_("git config remove-section [<file-option>] <name>"), N_("git config edit [<file-option>]"), @@ -33,17 +33,17 @@ static const char *const builtin_config_list_usage[] = { }; static const char *const builtin_config_get_usage[] = { - N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp=<regexp>] [--value=<value>] [--fixed-value] [--default=<default>] <name>"), + N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp=<regexp>] [--value=<pattern>] [--fixed-value] [--default=<default>] <name>"), NULL }; static const char *const builtin_config_set_usage[] = { - N_("git config set [<file-option>] [--type=<type>] [--comment=<message>] [--all] [--value=<value>] [--fixed-value] <name> <value>"), + N_("git config set [<file-option>] [--type=<type>] [--comment=<message>] [--all] [--value=<pattern>] [--fixed-value] <name> <value>"), NULL }; static const char *const builtin_config_unset_usage[] = { - N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>"), + N_("git config unset [<file-option>] [--all] [--value=<pattern>] [--fixed-value] <name>"), NULL }; diff --git a/builtin/diff.c b/builtin/diff.c index c6231edce4..eebffe36cc 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -483,7 +483,7 @@ int cmd_diff(int argc, * configurable via a command line option. */ if (nongit) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); init_diff_ui_defaults(); git_config(git_diff_ui_config, NULL); diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 6a3a17a8cd..f4169dc5f3 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -29,6 +29,7 @@ #include "quote.h" #include "remote.h" #include "blob.h" +#include "gpg-interface.h" static const char *const fast_export_usage[] = { N_("git fast-export [<rev-list-opts>]"), @@ -652,6 +653,38 @@ static const char *find_commit_multiline_header(const char *msg, return strbuf_detach(&val, NULL); } +static void print_signature(const char *signature, const char *object_hash) +{ + if (!signature) + return; + + printf("gpgsig %s %s\ndata %u\n%s\n", + object_hash, + get_signature_format(signature), + (unsigned)strlen(signature), + signature); +} + +static const char *append_signatures_for_header(struct string_list *signatures, + const char *pos, + const char *header, + const char *object_hash) +{ + const char *signature; + const char *start = pos; + const char *end = pos; + + while ((signature = find_commit_multiline_header(start + 1, + header, + &end))) { + string_list_append(signatures, signature)->util = (void *)object_hash; + free((char *)signature); + start = end; + } + + return end; +} + static void handle_commit(struct commit *commit, struct rev_info *rev, struct string_list *paths_of_changed_objects) { @@ -660,7 +693,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, const char *author, *author_end, *committer, *committer_end; const char *encoding = NULL; size_t encoding_len; - const char *signature_alg = NULL, *signature = NULL; + struct string_list signatures = STRING_LIST_INIT_DUP; const char *message; char *reencoded = NULL; struct commit_list *p; @@ -700,10 +733,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, } if (*commit_buffer_cursor == '\n') { - if ((signature = find_commit_multiline_header(commit_buffer_cursor + 1, "gpgsig", &commit_buffer_cursor))) - signature_alg = "sha1"; - else if ((signature = find_commit_multiline_header(commit_buffer_cursor + 1, "gpgsig-sha256", &commit_buffer_cursor))) - signature_alg = "sha256"; + const char *after_sha1 = append_signatures_for_header(&signatures, commit_buffer_cursor, + "gpgsig", "sha1"); + const char *after_sha256 = append_signatures_for_header(&signatures, commit_buffer_cursor, + "gpgsig-sha256", "sha256"); + commit_buffer_cursor = (after_sha1 > after_sha256) ? after_sha1 : after_sha256; } message = strstr(commit_buffer_cursor, "\n\n"); @@ -769,30 +803,30 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, printf("%.*s\n%.*s\n", (int)(author_end - author), author, (int)(committer_end - committer), committer); - if (signature) { + if (signatures.nr) { switch (signed_commit_mode) { case SIGN_ABORT: die("encountered signed commit %s; use " "--signed-commits=<mode> to handle it", oid_to_hex(&commit->object.oid)); case SIGN_WARN_VERBATIM: - warning("exporting signed commit %s", - oid_to_hex(&commit->object.oid)); + warning("exporting %"PRIuMAX" signature(s) for commit %s", + (uintmax_t)signatures.nr, oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_VERBATIM: - printf("gpgsig %s\ndata %u\n%s", - signature_alg, - (unsigned)strlen(signature), - signature); + for (size_t i = 0; i < signatures.nr; i++) { + struct string_list_item *item = &signatures.items[i]; + print_signature(item->string, item->util); + } break; case SIGN_WARN_STRIP: - warning("stripping signature from commit %s", + warning("stripping signature(s) from commit %s", oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_STRIP: break; } - free((char *)signature); + string_list_clear(&signatures, 0); } if (!reencoded && encoding) printf("encoding %.*s\n", (int)encoding_len, encoding); diff --git a/builtin/fast-import.c b/builtin/fast-import.c index b1389c5921..6e7d0c3449 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -29,6 +29,7 @@ #include "commit-reach.h" #include "khash.h" #include "date.h" +#include "gpg-interface.h" #define PACK_ID_BITS 16 #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1) @@ -2716,15 +2717,82 @@ static struct hash_list *parse_merge(unsigned int *count) return list; } +struct signature_data { + char *hash_algo; /* "sha1" or "sha256" */ + char *sig_format; /* "openpgp", "x509", "ssh", or "unknown" */ + struct strbuf data; /* The actual signature data */ +}; + +static void parse_one_signature(struct signature_data *sig, const char *v) +{ + char *args = xstrdup(v); /* Will be freed when sig->hash_algo is freed */ + char *space = strchr(args, ' '); + + if (!space) + die("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " + "got 'gpgsig %s'", args); + *space = '\0'; + + sig->hash_algo = args; + sig->sig_format = space + 1; + + /* Validate hash algorithm */ + if (strcmp(sig->hash_algo, "sha1") && + strcmp(sig->hash_algo, "sha256")) + die("Unknown git hash algorithm in gpgsig: '%s'", sig->hash_algo); + + /* Validate signature format */ + if (!valid_signature_format(sig->sig_format)) + die("Invalid signature format in gpgsig: '%s'", sig->sig_format); + if (!strcmp(sig->sig_format, "unknown")) + warning("'unknown' signature format in gpgsig"); + + /* Read signature data */ + read_next_command(); + parse_data(&sig->data, 0, NULL); +} + +static void add_gpgsig_to_commit(struct strbuf *commit_data, + const char *header, + struct signature_data *sig) +{ + struct string_list siglines = STRING_LIST_INIT_NODUP; + + if (!sig->hash_algo) + return; + + strbuf_addstr(commit_data, header); + string_list_split_in_place(&siglines, sig->data.buf, "\n", -1); + strbuf_add_separated_string_list(commit_data, "\n ", &siglines); + strbuf_addch(commit_data, '\n'); + string_list_clear(&siglines, 1); + strbuf_release(&sig->data); + free(sig->hash_algo); +} + +static void store_signature(struct signature_data *stored_sig, + struct signature_data *new_sig, + const char *hash_type) +{ + if (stored_sig->hash_algo) { + warning("multiple %s signatures found, " + "ignoring additional signature", + hash_type); + strbuf_release(&new_sig->data); + free(new_sig->hash_algo); + } else { + *stored_sig = *new_sig; + } +} + static void parse_new_commit(const char *arg) { - static struct strbuf sig = STRBUF_INIT; static struct strbuf msg = STRBUF_INIT; - struct string_list siglines = STRING_LIST_INIT_NODUP; + struct signature_data sig_sha1 = { NULL, NULL, STRBUF_INIT }; + struct signature_data sig_sha256 = { NULL, NULL, STRBUF_INIT }; struct branch *b; char *author = NULL; char *committer = NULL; - char *sig_alg = NULL; char *encoding = NULL; struct hash_list *merge_list = NULL; unsigned int merge_count; @@ -2748,13 +2816,23 @@ static void parse_new_commit(const char *arg) } if (!committer) die("Expected committer but didn't get one"); - if (skip_prefix(command_buf.buf, "gpgsig ", &v)) { - sig_alg = xstrdup(v); - read_next_command(); - parse_data(&sig, 0, NULL); + + /* Process signatures (up to 2: one "sha1" and one "sha256") */ + while (skip_prefix(command_buf.buf, "gpgsig ", &v)) { + struct signature_data sig = { NULL, NULL, STRBUF_INIT }; + + parse_one_signature(&sig, v); + + if (!strcmp(sig.hash_algo, "sha1")) + store_signature(&sig_sha1, &sig, "SHA-1"); + else if (!strcmp(sig.hash_algo, "sha256")) + store_signature(&sig_sha256, &sig, "SHA-256"); + else + BUG("parse_one_signature() returned unknown hash algo"); + read_next_command(); - } else - strbuf_setlen(&sig, 0); + } + if (skip_prefix(command_buf.buf, "encoding ", &v)) { encoding = xstrdup(v); read_next_command(); @@ -2828,23 +2906,14 @@ static void parse_new_commit(const char *arg) strbuf_addf(&new_data, "encoding %s\n", encoding); - if (sig_alg) { - if (!strcmp(sig_alg, "sha1")) - strbuf_addstr(&new_data, "gpgsig "); - else if (!strcmp(sig_alg, "sha256")) - strbuf_addstr(&new_data, "gpgsig-sha256 "); - else - die("Expected gpgsig algorithm sha1 or sha256, got %s", sig_alg); - string_list_split_in_place(&siglines, sig.buf, "\n", -1); - strbuf_add_separated_string_list(&new_data, "\n ", &siglines); - strbuf_addch(&new_data, '\n'); - } + + add_gpgsig_to_commit(&new_data, "gpgsig ", &sig_sha1); + add_gpgsig_to_commit(&new_data, "gpgsig-sha256 ", &sig_sha256); + strbuf_addch(&new_data, '\n'); strbuf_addbuf(&new_data, &msg); - string_list_clear(&siglines, 1); free(author); free(committer); - free(sig_alg); free(encoding); if (!store_object(OBJ_COMMIT, &new_data, NULL, &b->oid, next_mark)) diff --git a/builtin/fetch.c b/builtin/fetch.c index d231a669d7..87a0cca799 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1340,9 +1340,10 @@ static int prune_refs(struct display_state *display_state, int result = 0; struct ref *ref, *stale_refs = get_stale_heads(rs, ref_map); struct strbuf err = STRBUF_INIT; - const char *dangling_msg = dry_run - ? _(" (%s will become dangling)") - : _(" (%s has become dangling)"); + struct string_list refnames = STRING_LIST_INIT_NODUP; + + for (ref = stale_refs; ref; ref = ref->next) + string_list_append(&refnames, ref->name); if (!dry_run) { if (transaction) { @@ -1353,15 +1354,9 @@ static int prune_refs(struct display_state *display_state, goto cleanup; } } else { - struct string_list refnames = STRING_LIST_INIT_NODUP; - - for (ref = stale_refs; ref; ref = ref->next) - string_list_append(&refnames, ref->name); - result = refs_delete_refs(get_main_ref_store(the_repository), "fetch: prune", &refnames, 0); - string_list_clear(&refnames, 0); } } @@ -1373,12 +1368,14 @@ static int prune_refs(struct display_state *display_state, _("(none)"), ref->name, &ref->new_oid, &ref->old_oid, summary_width); - refs_warn_dangling_symref(get_main_ref_store(the_repository), - stderr, dangling_msg, ref->name); } + string_list_sort(&refnames); + refs_warn_dangling_symrefs(get_main_ref_store(the_repository), + stderr, " ", dry_run, &refnames); } cleanup: + string_list_clear(&refnames, 0); strbuf_release(&err); free_refs(stale_refs); return result; diff --git a/builtin/gc.c b/builtin/gc.c index 21bd44e164..fab8f4dd4f 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -539,7 +539,7 @@ static uint64_t total_ram(void) return total; } #elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64)) - int64_t physical_memory; + uint64_t physical_memory; int mib[2]; size_t length; @@ -551,9 +551,16 @@ static uint64_t total_ram(void) # else mib[1] = HW_PHYSMEM; # endif - length = sizeof(int64_t); - if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0)) + length = sizeof(physical_memory); + if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0)) { + if (length == 4) { + uint32_t mem; + + if (!sysctl(mib, 2, &mem, &length, NULL, 0)) + physical_memory = mem; + } return physical_memory; + } #elif defined(GIT_WINDOWS_NATIVE) MEMORYSTATUSEX memInfo; @@ -998,7 +1005,7 @@ int cmd_gc(int argc, if (opts.detach <= 0 && !skip_foreground_tasks) gc_foreground_tasks(&opts, &cfg); - if (!repository_format_precious_objects) { + if (!the_repository->repository_format_precious_objects) { struct child_process repack_cmd = CHILD_PROCESS_INIT; repack_cmd.git_cmd = 1; diff --git a/builtin/hash-object.c b/builtin/hash-object.c index e28f000221..ddf281413a 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -104,7 +104,7 @@ int cmd_hash_object(int argc, prefix = setup_git_directory_gently(&nongit); if (nongit && !the_hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); if (vpath && prefix) { vpath_free = prefix_filename(prefix, vpath); diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 19c67a8534..0a5c8a1ac8 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -2035,7 +2035,7 @@ int cmd_index_pack(int argc, * choice but to guess the object hash. */ if (!the_repository->hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); opts.flags &= ~(WRITE_REV | WRITE_REV_VERIFY); if (rev_index) { diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 01a4d4daa1..df09000b30 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -112,7 +112,7 @@ int cmd_ls_remote(int argc, * depending on what object hash the remote uses. */ if (!the_repository->hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); packet_trace_identity("ls-remote"); diff --git a/builtin/patch-id.c b/builtin/patch-id.c index cdef2ec10a..26f04b0335 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -254,7 +254,7 @@ int cmd_patch_id(int argc, * the code that computes patch IDs to always use SHA1. */ if (!the_hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); generate_id_list(opts ? opts > 1 : config.stable, opts ? opts == 3 : config.verbatim); diff --git a/builtin/prune.c b/builtin/prune.c index 339017c7cc..d1c0ee1419 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -1,4 +1,3 @@ -#define USE_THE_REPOSITORY_VARIABLE #define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" @@ -64,7 +63,7 @@ static void perform_reachability_traversal(struct rev_info *revs) return; if (show_progress) - progress = start_delayed_progress(the_repository, + progress = start_delayed_progress(revs->repo, _("Checking connectivity"), 0); mark_reachable_objects(revs, 1, expire, progress); stop_progress(&progress); @@ -78,7 +77,7 @@ static int is_object_reachable(const struct object_id *oid, perform_reachability_traversal(revs); - obj = lookup_object(the_repository, oid); + obj = lookup_object(revs->repo, oid); return obj && (obj->flags & SEEN); } @@ -99,8 +98,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath, if (st.st_mtime > expire) return 0; if (show_only || verbose) { - enum object_type type = odb_read_object_info(the_repository->objects, - oid, NULL); + enum object_type type = + odb_read_object_info(revs->repo->objects, oid, NULL); printf("%s %s\n", oid_to_hex(oid), (type > 0) ? type_name(type) : "unknown"); } @@ -154,7 +153,7 @@ static void remove_temporary_files(const char *path) int cmd_prune(int argc, const char **argv, const char *prefix, - struct repository *repo UNUSED) + struct repository *repo) { struct rev_info revs; int exclude_promisor_objects = 0; @@ -173,20 +172,19 @@ int cmd_prune(int argc, expire = TIME_MAX; save_commit_buffer = 0; disable_replace_refs(); - repo_init_revisions(the_repository, &revs, prefix); argc = parse_options(argc, argv, prefix, options, prune_usage, 0); - if (repository_format_precious_objects) + repo_init_revisions(repo, &revs, prefix); + if (repo->repository_format_precious_objects) die(_("cannot prune in a precious-objects repo")); while (argc--) { struct object_id oid; const char *name = *argv++; - if (!repo_get_oid(the_repository, name, &oid)) { - struct object *object = parse_object_or_die(the_repository, &oid, - name); + if (!repo_get_oid(repo, name, &oid)) { + struct object *object = parse_object_or_die(repo, &oid, name); add_pending_object(&revs, object, ""); } else @@ -200,16 +198,16 @@ int cmd_prune(int argc, revs.exclude_promisor_objects = 1; } - for_each_loose_file_in_objdir(repo_get_object_directory(the_repository), + for_each_loose_file_in_objdir(repo_get_object_directory(repo), prune_object, prune_cruft, prune_subdir, &revs); prune_packed_objects(show_only ? PRUNE_PACKED_DRY_RUN : 0); - remove_temporary_files(repo_get_object_directory(the_repository)); - s = mkpathdup("%s/pack", repo_get_object_directory(the_repository)); + remove_temporary_files(repo_get_object_directory(repo)); + s = mkpathdup("%s/pack", repo_get_object_directory(repo)); remove_temporary_files(s); free(s); - if (is_repository_shallow(the_repository)) { + if (is_repository_shallow(repo)) { perform_reachability_traversal(&revs); prune_shallow(show_only ? PRUNE_SHOW_ONLY : 0); } diff --git a/builtin/rebase.c b/builtin/rebase.c index 2e8c4ee678..e90562a3b8 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1128,6 +1128,7 @@ int cmd_rebase(int argc, .short_name = 'n', .long_name = "no-stat", .value = &options.flags, + .precision = sizeof(options.flags), .help = N_("do not show diffstat of what changed upstream"), .flags = PARSE_OPT_NOARG, .defval = REBASE_DIFFSTAT, diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index dd1d1446e7..7974d157eb 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2203,7 +2203,7 @@ static struct command *read_head_info(struct packet_reader *reader, use_push_options = 1; hash = parse_feature_value(feature_list, "object-format", &len, NULL); if (!hash) { - hash = hash_algos[GIT_HASH_SHA1].name; + hash = hash_algos[GIT_HASH_SHA1_LEGACY].name; len = strlen(hash); } if (xstrncmpz(the_hash_algo->name, hash, len)) diff --git a/builtin/remote.c b/builtin/remote.c index 7cbda285eb..5dd6cbbaee 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -157,6 +157,21 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not) return 0; } +static int check_remote_collision(struct remote *remote, void *data) +{ + const char *name = data; + const char *p; + + if (skip_prefix(name, remote->name, &p) && *p == '/') + die(_("remote name '%s' is a subset of existing remote '%s'"), + name, remote->name); + if (skip_prefix(remote->name, name, &p) && *p == '/') + die(_("remote name '%s' is a superset of existing remote '%s'"), + name, remote->name); + + return 0; +} + static int add(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { @@ -208,6 +223,8 @@ static int add(int argc, const char **argv, const char *prefix, if (!valid_remote_name(name)) die(_("'%s' is not a valid remote name"), name); + for_each_remote(check_remote_collision, (void *)name); + strbuf_addf(&buf, "remote.%s.url", name); git_config_set(buf.buf, url); @@ -1521,9 +1538,6 @@ static int prune_remote(const char *remote, int dry_run) struct ref_states states = REF_STATES_INIT; struct string_list refs_to_prune = STRING_LIST_INIT_NODUP; struct string_list_item *item; - const char *dangling_msg = dry_run - ? _(" %s will become dangling!") - : _(" %s has become dangling!"); get_remote_ref_states(remote, &states, GET_REF_STATES); @@ -1555,7 +1569,7 @@ static int prune_remote(const char *remote, int dry_run) } refs_warn_dangling_symrefs(get_main_ref_store(the_repository), - stdout, dangling_msg, &refs_to_prune); + stdout, " ", dry_run, &refs_to_prune); string_list_clear(&refs_to_prune, 0); free_remote_ref_states(&states); diff --git a/builtin/repack.c b/builtin/repack.c index d63e1a9fec..21723866b9 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1350,7 +1350,7 @@ int cmd_repack(int argc, po_args.depth = xstrdup_or_null(opt_depth); po_args.threads = xstrdup_or_null(opt_threads); - if (delete_redundant && repository_format_precious_objects) + if (delete_redundant && the_repository->repository_format_precious_objects) die(_("cannot delete packs in a precious-objects repo")); die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A", diff --git a/builtin/shortlog.c b/builtin/shortlog.c index fe15e11497..60adc5e7a5 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -419,7 +419,7 @@ int cmd_shortlog(int argc, * git/nongit so that we do not have to do this. */ if (nongit && !the_hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); git_config(git_default_config, NULL); shortlog_init(&log); diff --git a/builtin/show-index.c b/builtin/show-index.c index 9d4ecf5e7b..2c3e2940ce 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -47,7 +47,7 @@ int cmd_show_index(int argc, * the index file passed in and use that instead. */ if (!the_hash_algo) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); hashsz = the_hash_algo->rawsz; diff --git a/builtin/update-index.c b/builtin/update-index.c index 538b619ba4..0c1d4ed55b 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -981,6 +981,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "assume-unchanged", .value = &mark_valid_only, + .precision = sizeof(mark_valid_only), .help = N_("mark files as \"not changing\""), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = MARK_FLAG, @@ -989,6 +990,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "no-assume-unchanged", .value = &mark_valid_only, + .precision = sizeof(mark_valid_only), .help = N_("clear assumed-unchanged bit"), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = UNMARK_FLAG, @@ -997,6 +999,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "skip-worktree", .value = &mark_skip_worktree_only, + .precision = sizeof(mark_skip_worktree_only), .help = N_("mark files as \"index-only\""), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = MARK_FLAG, @@ -1005,6 +1008,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "no-skip-worktree", .value = &mark_skip_worktree_only, + .precision = sizeof(mark_skip_worktree_only), .help = N_("clear skip-worktree bit"), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = UNMARK_FLAG, @@ -1079,6 +1083,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "fsmonitor-valid", .value = &mark_fsmonitor_only, + .precision = sizeof(mark_fsmonitor_only), .help = N_("mark files as fsmonitor valid"), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = MARK_FLAG, @@ -1087,6 +1092,7 @@ int cmd_update_index(int argc, .type = OPTION_SET_INT, .long_name = "no-fsmonitor-valid", .value = &mark_fsmonitor_only, + .precision = sizeof(mark_fsmonitor_only), .help = N_("clear fsmonitor valid bit"), .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = UNMARK_FLAG, diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 5a8dc377ec..cfec044710 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -35,6 +35,7 @@ int cmd_write_tree(int argc, .type = OPTION_BIT, .long_name = "ignore-cache-tree", .value = &flags, + .precision = sizeof(flags), .help = N_("only useful for debugging"), .flags = PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, .defval = WRITE_TREE_IGNORE_CACHE_TREE, @@ -95,7 +95,7 @@ int read_bundle_header_fd(int fd, struct bundle_header *header, * by an "object-format=" capability, which is being handled in * `parse_capability()`. */ - header->hash_algo = &hash_algos[GIT_HASH_SHA1]; + header->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY]; /* The bundle header ends with an empty line */ while (!strbuf_getwholeline_fd(&buf, fd, '\n') && @@ -507,7 +507,7 @@ int create_bundle(struct repository *r, const char *path, * SHA1. * 2. @filter is required because we parsed an object filter. */ - if (the_hash_algo != &hash_algos[GIT_HASH_SHA1] || revs.filter.choice) + if (the_hash_algo != &hash_algos[GIT_HASH_SHA1_LEGACY] || revs.filter.choice) min_version = 3; if (argc > 1) { diff --git a/ci/run-style-check.sh b/ci/run-style-check.sh index 6cd4b1d934..0832c19df0 100755 --- a/ci/run-style-check.sh +++ b/ci/run-style-check.sh @@ -5,21 +5,5 @@ baseCommit=$1 -# Remove optional braces of control statements (if, else, for, and while) -# according to the LLVM coding style. This avoids braces on simple -# single-statement bodies of statements but keeps braces if one side of -# if/else if/.../else cascade has multi-statement body. -# -# As this rule comes with a warning [1], we want to experiment with it -# before adding it in-tree. since the CI job for the style check is allowed -# to fail, appending the rule here allows us to validate its efficacy. -# While also ensuring that end-users are not affected directly. -# -# [1]: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#removebracesllvm -{ - cat .clang-format - echo "RemoveBracesLLVM: true" -} >/tmp/clang-format-rules - -git clang-format --style=file:/tmp/clang-format-rules \ +git clang-format --style=file:.clang-format \ --diff --extensions c,h "$baseCommit" @@ -31,6 +31,7 @@ #include "parse.h" #include "object-file.h" #include "object-file-convert.h" +#include "prio-queue.h" static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); @@ -739,20 +740,27 @@ void commit_list_sort_by_date(struct commit_list **list) commit_list_sort(list, commit_list_compare_by_date); } -struct commit *pop_most_recent_commit(struct commit_list **list, +struct commit *pop_most_recent_commit(struct prio_queue *queue, unsigned int mark) { - struct commit *ret = pop_commit(list); + struct commit *ret = prio_queue_peek(queue); + int get_pending = 1; struct commit_list *parents = ret->parents; while (parents) { struct commit *commit = parents->item; if (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) { commit->object.flags |= mark; - commit_list_insert_by_date(commit, list); + if (get_pending) + prio_queue_replace(queue, commit); + else + prio_queue_put(queue, commit); + get_pending = 0; } parents = parents->next; } + if (get_pending) + prio_queue_get(queue); return ret; } @@ -201,10 +201,10 @@ const char *repo_logmsg_reencode(struct repository *r, const char *skip_blank_lines(const char *msg); -/** Removes the first commit from a list sorted by date, and adds all - * of its parents. - **/ -struct commit *pop_most_recent_commit(struct commit_list **list, +struct prio_queue; + +/* Removes the first commit from a prio_queue and adds its parents. */ +struct commit *pop_most_recent_commit(struct prio_queue *queue, unsigned int mark); struct commit *pop_commit(struct commit_list **stack); diff --git a/compat/bswap.h b/compat/bswap.h index b34054f2bd..28635ebc69 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -32,78 +32,35 @@ static inline uint64_t default_bswap64(uint64_t val) ((val & (uint64_t)0xff00000000000000ULL) >> 56)); } +/* + * __has_builtin is available since Clang 10 and GCC 10. + * Below is a fallback for older compilers. + */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + #undef bswap32 #undef bswap64 -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - -#define bswap32 git_bswap32 -static inline uint32_t git_bswap32(uint32_t x) -{ - uint32_t result; - if (__builtin_constant_p(x)) - result = default_swab32(x); - else - __asm__("bswap %0" : "=r" (result) : "0" (x)); - return result; -} - -#define bswap64 git_bswap64 -#if defined(__x86_64__) -static inline uint64_t git_bswap64(uint64_t x) -{ - uint64_t result; - if (__builtin_constant_p(x)) - result = default_bswap64(x); - else - __asm__("bswap %q0" : "=r" (result) : "0" (x)); - return result; -} -#else -static inline uint64_t git_bswap64(uint64_t x) -{ - union { uint64_t i64; uint32_t i32[2]; } tmp, result; - if (__builtin_constant_p(x)) - result.i64 = default_bswap64(x); - else { - tmp.i64 = x; - result.i32[0] = git_bswap32(tmp.i32[1]); - result.i32[1] = git_bswap32(tmp.i32[0]); - } - return result.i64; -} -#endif - -#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64)) +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64)) #include <stdlib.h> #define bswap32(x) _byteswap_ulong(x) #define bswap64(x) _byteswap_uint64(x) -#endif +#define GIT_LITTLE_ENDIAN 1234 +#define GIT_BIG_ENDIAN 4321 +#define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN -#if defined(bswap32) +#elif __has_builtin(__builtin_bswap32) && __has_builtin(__builtin_bswap64) -#undef ntohl -#undef htonl -#define ntohl(x) bswap32(x) -#define htonl(x) bswap32(x) +#define bswap32(x) __builtin_bswap32((x)) +#define bswap64(x) __builtin_bswap64((x)) #endif -#if defined(bswap64) - -#undef ntohll -#undef htonll -#define ntohll(x) bswap64(x) -#define htonll(x) bswap64(x) - -#else - -#undef ntohll -#undef htonll - #if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) # define GIT_BYTE_ORDER __BYTE_ORDER @@ -116,7 +73,13 @@ static inline uint64_t git_bswap64(uint64_t x) # define GIT_LITTLE_ENDIAN LITTLE_ENDIAN # define GIT_BIG_ENDIAN BIG_ENDIAN -#else +#elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) + +# define GIT_BYTE_ORDER __BYTE_ORDER__ +# define GIT_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +# define GIT_BIG_ENDIAN __ORDER_BIG_ENDIAN__ + +#elif !defined(GIT_BYTE_ORDER) # define GIT_BIG_ENDIAN 4321 # define GIT_LITTLE_ENDIAN 1234 @@ -135,14 +98,33 @@ static inline uint64_t git_bswap64(uint64_t x) #endif +#undef ntohl +#undef htonl +#undef ntohll +#undef htonll + #if GIT_BYTE_ORDER == GIT_BIG_ENDIAN -# define ntohll(n) (n) -# define htonll(n) (n) +# define ntohl(x) (x) +# define htonl(x) (x) +# define ntohll(x) (x) +# define htonll(x) (x) #else -# define ntohll(n) default_bswap64(n) -# define htonll(n) default_bswap64(n) -#endif +# if defined(bswap32) +# define ntohl(x) bswap32(x) +# define htonl(x) bswap32(x) +# else +# define ntohl(x) default_swab32(x) +# define htonl(x) default_swab32(x) +# endif + +# if defined(bswap64) +# define ntohll(x) bswap64(x) +# define htonll(x) bswap64(x) +# else +# define ntohll(x) default_bswap64(x) +# define htonll(x) default_bswap64(x) +# endif #endif static inline uint16_t get_be16(const void *ptr) diff --git a/compat/mingw-posix.h b/compat/mingw-posix.h index 88e0cf9292..631a208684 100644 --- a/compat/mingw-posix.h +++ b/compat/mingw-posix.h @@ -96,6 +96,7 @@ struct sigaction { unsigned sa_flags; }; #define SA_RESTART 0 +#define SA_NOCLDSTOP 1 struct itimerval { struct timeval it_value, it_interval; diff --git a/compat/mingw.c b/compat/mingw.c index 8a9972a1ca..5d69ae32f4 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2561,7 +2561,9 @@ int setitimer(int type UNUSED, struct itimerval *in, struct itimerval *out) int sigaction(int sig, struct sigaction *in, struct sigaction *out) { - if (sig != SIGALRM) + if (sig == SIGCHLD) + return -1; + else if (sig != SIGALRM) return errno = EINVAL, error("sigaction only implemented for SIGALRM"); if (out) @@ -56,7 +56,6 @@ struct config_source { } u; enum config_origin_type origin_type; const char *name; - const char *path; enum config_error_action default_error_action; int linenr; int eof; @@ -173,14 +172,14 @@ static int handle_path_include(const struct key_value_info *kvi, if (!is_absolute_path(path)) { char *slash; - if (!kvi || !kvi->path) { + if (!kvi || kvi->origin_type != CONFIG_ORIGIN_FILE) { ret = error(_("relative config includes must come from files")); goto cleanup; } - slash = find_last_dir_sep(kvi->path); + slash = find_last_dir_sep(kvi->filename); if (slash) - strbuf_add(&buf, kvi->path, slash - kvi->path + 1); + strbuf_add(&buf, kvi->filename, slash - kvi->filename + 1); strbuf_addstr(&buf, path); path = buf.buf; } @@ -224,11 +223,11 @@ static int prepare_include_condition_pattern(const struct key_value_info *kvi, if (pat->buf[0] == '.' && is_dir_sep(pat->buf[1])) { const char *slash; - if (!kvi || !kvi->path) + if (!kvi || kvi->origin_type != CONFIG_ORIGIN_FILE) return error(_("relative config include " "conditionals must come from files")); - strbuf_realpath(&path, kvi->path, 1); + strbuf_realpath(&path, kvi->filename, 1); slash = find_last_dir_sep(path.buf); if (!slash) BUG("how is this possible?"); @@ -633,7 +632,6 @@ void kvi_from_param(struct key_value_info *out) out->linenr = -1; out->origin_type = CONFIG_ORIGIN_CMDLINE; out->scope = CONFIG_SCOPE_COMMAND; - out->path = NULL; } int git_config_parse_parameter(const char *text, @@ -1036,7 +1034,6 @@ static void kvi_from_source(struct config_source *cs, out->origin_type = cs->origin_type; out->linenr = cs->linenr; out->scope = scope; - out->path = cs->path; } static int git_parse_source(struct config_source *cs, config_fn_t fn, @@ -1537,9 +1534,11 @@ static int git_default_core_config(const char *var, const char *value, !strcmp(var, "core.commentstring")) { if (!value) return config_error_nonbool(var); - else if (!strcasecmp(value, "auto")) + else if (!strcasecmp(value, "auto")) { auto_comment_line_char = 1; - else if (value[0]) { + FREE_AND_NULL(comment_line_str_to_free); + comment_line_str = "#"; + } else if (value[0]) { if (strchr(value, '\n')) return error(_("%s cannot contain newline"), var); comment_line_str = value; @@ -1850,17 +1849,19 @@ static int do_config_from(struct config_source *top, config_fn_t fn, 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, enum config_scope scope, + const char *name, FILE *f, void *data, + enum config_scope scope, const struct config_options *opts) { struct config_source top = CONFIG_SOURCE_INIT; int ret; + if (origin_type == CONFIG_ORIGIN_FILE && (!name || !*name)) + BUG("missing filename for CONFIG_ORIGIN_FILE"); + top.u.file = f; top.origin_type = origin_type; top.name = name; - top.path = path; top.default_error_action = CONFIG_ERROR_DIE; top.do_fgetc = config_file_fgetc; top.do_ungetc = config_file_ungetc; @@ -1875,8 +1876,8 @@ static int do_config_from_file(config_fn_t fn, static int git_config_from_stdin(config_fn_t fn, void *data, enum config_scope scope) { - return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin, - data, scope, NULL); + return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", stdin, data, + scope, NULL); } int git_config_from_file_with_options(config_fn_t fn, const char *filename, @@ -1891,7 +1892,7 @@ int git_config_from_file_with_options(config_fn_t fn, const char *filename, f = fopen_or_warn(filename, "r"); if (f) { ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename, - filename, f, data, scope, opts); + f, data, scope, opts); fclose(f); } return ret; @@ -1916,7 +1917,6 @@ int git_config_from_mem(config_fn_t fn, top.u.buf.pos = 0; top.origin_type = origin_type; top.name = name; - top.path = NULL; top.default_error_action = CONFIG_ERROR_ERROR; top.do_fgetc = config_buf_fgetc; top.do_ungetc = config_buf_ungetc; @@ -122,14 +122,12 @@ struct key_value_info { int linenr; enum config_origin_type origin_type; enum config_scope scope; - const char *path; }; #define KVI_INIT { \ .filename = NULL, \ .linenr = -1, \ .origin_type = CONFIG_ORIGIN_UNKNOWN, \ .scope = CONFIG_SCOPE_UNKNOWN, \ - .path = NULL, \ } /* Captures additional information that a config callback can use. */ diff --git a/config.mak.uname b/config.mak.uname index b1c5c4d5e8..1691c6ae6e 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -302,16 +302,13 @@ ifeq ($(uname_S),FreeBSD) ifeq ($(firstword $(subst -, ,$(uname_R))),10.1) OLD_ICONV = YesPlease endif - NO_MEMMEM = YesPlease + ifeq ($(shell v=$(uname_R) && test $${v%%.*} -lt 12 && echo 1),1) + NO_MEMMEM = UnfortunatelyYes + endif BASIC_CFLAGS += -I/usr/local/include BASIC_LDFLAGS += -L/usr/local/lib DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease USE_ST_TIMESPEC = YesPlease - ifeq ($(shell expr "$(uname_R)" : '4\.'),2) - PTHREAD_LIBS = -pthread - NO_UINTMAX_T = YesPlease - NO_STRTOUMAX = YesPlease - endif PYTHON_PATH = /usr/local/bin/python PERL_PATH = /usr/local/bin/perl HAVE_PATHS_H = YesPlease diff --git a/configure.ac b/configure.ac index f6caab919a..cfb50112bf 100644 --- a/configure.ac +++ b/configure.ac @@ -1068,32 +1068,6 @@ AC_CHECK_LIB([iconv], [locale_charset], GIT_CONF_SUBST([CHARSET_LIB]) # -# Define HAVE_SYSINFO=YesPlease if sysinfo is available. -# -AC_DEFUN([HAVE_SYSINFO_SRC], [ -AC_LANG_PROGRAM([[ -#include <stdint.h> -#include <sys/sysinfo.h> -]], [[ -struct sysinfo si; -uint64_t t = 0; -if (!sysinfo(&si)) { - t = si.totalram; - if (si.mem_unit > 1) - t *= (uint64_t)si.mem_unit; -} -return t; -]])]) - -AC_MSG_CHECKING([for sysinfo]) -AC_COMPILE_IFELSE([HAVE_SYSINFO_SRC], - [AC_MSG_RESULT([yes]) - HAVE_SYSINFO=YesPlease], - [AC_MSG_RESULT([no]) - HAVE_SYSINFO=]) -GIT_CONF_SUBST([HAVE_SYSINFO]) - -# # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. GIT_CHECK_FUNC(clock_gettime, [HAVE_CLOCK_GETTIME=YesPlease], @@ -1148,14 +1122,6 @@ GIT_CHECK_FUNC(strlcpy, [NO_STRLCPY=YesPlease]) GIT_CONF_SUBST([NO_STRLCPY]) # -# Define NO_UINTMAX_T if your platform does not have uintmax_t -AC_CHECK_TYPE(uintmax_t, -[NO_UINTMAX_T=], -[NO_UINTMAX_T=YesPlease],[ -#include <inttypes.h> -]) -GIT_CONF_SUBST([NO_UINTMAX_T]) -# # Define NO_STRTOUMAX if you don't have strtoumax in the C library. GIT_CHECK_FUNC(strtoumax, [NO_STRTOUMAX=], @@ -1221,6 +1187,41 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC], HAVE_BSD_SYSCTL=]) GIT_CONF_SUBST([HAVE_BSD_SYSCTL]) +# +# Define HAVE_SYSINFO=YesPlease if sysinfo is available. +# + +HAVE_SYSINFO= +# on a *BSD system, sysctl() takes precedence over the +# sysinfo() compatibility library (if installed). + +if test -z "$HAVE_BSD_SYSCTL"; then + + AC_DEFUN([HAVE_SYSINFO_SRC], [ + AC_LANG_PROGRAM([[ + #include <stdint.h> + #include <sys/sysinfo.h> + ]], [[ + struct sysinfo si; + uint64_t t = 0; + if (!sysinfo(&si)) { + t = si.totalram; + if (si.mem_unit > 1) + t *= (uint64_t)si.mem_unit; + } + return t; + ]])]) + + AC_MSG_CHECKING([for sysinfo]) + AC_COMPILE_IFELSE([HAVE_SYSINFO_SRC], + [AC_MSG_RESULT([yes]) + HAVE_SYSINFO=YesPlease], + [AC_MSG_RESULT([no]) + HAVE_SYSINFO=]) + GIT_CONF_SUBST([HAVE_SYSINFO]) + +fi + ## Other checks. # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. # Enable it on Windows. By default, symrefs are still used. @@ -251,7 +251,7 @@ static void process_capabilities(struct packet_reader *reader, size_t *linelen) reader->hash_algo = &hash_algos[hash_algo]; free(hash_name); } else { - reader->hash_algo = &hash_algos[GIT_HASH_SHA1]; + reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY]; } } @@ -500,7 +500,7 @@ static void send_capabilities(int fd_out, struct packet_reader *reader) reader->hash_algo = &hash_algos[hash_algo]; packet_write_fmt(fd_out, "object-format=%s", reader->hash_algo->name); } else { - reader->hash_algo = &hash_algos[GIT_HASH_SHA1]; + reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY]; } if (server_feature_v2("promisor-remote", &promisor_remote_info)) { char *reply = promisor_remote_reply(promisor_remote_info); @@ -665,7 +665,7 @@ int server_supports_hash(const char *desired, int *feature_supported) if (feature_supported) *feature_supported = !!hash; if (!hash) { - hash = hash_algos[GIT_HASH_SHA1].name; + hash = hash_algos[GIT_HASH_SHA1_LEGACY].name; len = strlen(hash); } while (hash) { diff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl index 9fb998ae09..3c0a532d0e 100755 --- a/contrib/credential/netrc/git-credential-netrc.perl +++ b/contrib/credential/netrc/git-credential-netrc.perl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; @@ -267,8 +267,16 @@ sub load_netrc { if (!defined $nentry->{machine}) { next; } - if (defined $nentry->{port} && $nentry->{port} =~ m/^\d+$/) { - $num_port = $nentry->{port}; + if (defined $nentry->{port}) { + $num_port = Git::port_num($nentry->{port}); + unless ($num_port) { + printf(STDERR "ignoring invalid port `%s' " . + "from netrc file\n", $nentry->{port}); + } + # Since we've already validated and converted + # the port to its numerical value, do not + # capture it as the `protocol' value, as used + # to be the case for symbolic port names. delete $nentry->{port}; } diff --git a/contrib/credential/netrc/test.pl b/contrib/credential/netrc/test.pl index 67a0ede564..8a7fc2588a 100755 --- a/contrib/credential/netrc/test.pl +++ b/contrib/credential/netrc/test.pl @@ -45,7 +45,7 @@ chmod 0600, $netrc; diag "Testing with invalid data\n"; $cred = run_credential(['-f', $netrc, 'get'], "bad data"); -ok(scalar keys %$cred == 4, "Got first found keys with bad data"); +ok(scalar keys %$cred == 3, "Got first found keys with bad data"); diag "Testing netrc file for a missing corovamilkbar entry\n"; $cred = run_credential(['-f', $netrc, 'get'], @@ -64,12 +64,12 @@ is($cred->{username}, 'carol', "Got correct Github username"); diag "Testing netrc file for a username-specific entry\n"; $cred = run_credential(['-f', $netrc, 'get'], - { host => 'imap', username => 'bob' }); + { host => 'imap:993', username => 'bob' }); -ok(scalar keys %$cred == 2, "Got 2 username-specific keys"); +# Only the password field gets returned. +ok(scalar keys %$cred == 1, "Got 1 username-specific keys"); is($cred->{password}, 'bobwillknow', "Got correct user-specific password"); -is($cred->{protocol}, 'imaps', "Got correct user-specific protocol"); diag "Testing netrc file for a host:port-specific entry\n"; $cred = run_credential(['-f', $netrc, 'get'], @@ -915,11 +915,9 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) static void child_handler(int signo UNUSED) { /* - * Otherwise empty handler because systemcalls will get interrupted - * upon signal receipt - * SysV needs the handler to be rearmed + * Otherwise empty handler because systemcalls should get interrupted + * upon signal receipt. */ - signal(SIGCHLD, child_handler); } static int set_reuse_addr(int sockfd) @@ -1115,6 +1113,7 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct s static int service_loop(struct socketlist *socklist) { + struct sigaction sa; struct pollfd *pfd; CALLOC_ARRAY(pfd, socklist->nr); @@ -1124,7 +1123,10 @@ static int service_loop(struct socketlist *socklist) pfd[i].events = POLLIN; } - signal(SIGCHLD, child_handler); + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = child_handler; + sigaction(SIGCHLD, &sa, NULL); for (;;) { check_dead_children(); diff --git a/environment.c b/environment.c index 7bf0390a33..7c2480b22e 100644 --- a/environment.c +++ b/environment.c @@ -37,7 +37,6 @@ int ignore_case; int assume_unchanged; int is_bare_repository_cfg = -1; /* unspecified */ int warn_on_object_refname_ambiguity = 1; -int repository_format_precious_objects; char *git_commit_encoding; char *git_log_output_encoding; char *apply_default_whitespace; diff --git a/environment.h b/environment.h index 9a3d05d414..3d806ced6e 100644 --- a/environment.h +++ b/environment.h @@ -189,8 +189,6 @@ extern enum object_creation_mode object_creation_mode; extern int grafts_keep_true_parents; -extern int repository_format_precious_objects; - const char *get_log_output_encoding(void); const char *get_commit_output_encoding(void); diff --git a/fetch-pack.c b/fetch-pack.c index 5e74235fc0..c1be9b76eb 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -34,6 +34,7 @@ #include "commit-graph.h" #include "sigchain.h" #include "mergesort.h" +#include "prio-queue.h" static int transfer_unpack_limit = -1; static int fetch_unpack_limit = -1; @@ -601,7 +602,7 @@ done: return count ? retval : 0; } -static struct commit_list *complete; +static struct prio_queue complete = { compare_commits_by_commit_date }; static int mark_complete(const struct object_id *oid) { @@ -609,7 +610,7 @@ static int mark_complete(const struct object_id *oid) if (commit && !(commit->object.flags & COMPLETE)) { commit->object.flags |= COMPLETE; - commit_list_insert(commit, &complete); + prio_queue_put(&complete, commit); } return 0; } @@ -626,9 +627,12 @@ static int mark_complete_oid(const char *refname UNUSED, static void mark_recent_complete_commits(struct fetch_pack_args *args, timestamp_t cutoff) { - while (complete && cutoff <= complete->item->date) { + while (complete.nr) { + struct commit *item = prio_queue_peek(&complete); + if (item->date < cutoff) + break; print_verbose(args, _("Marking %s as complete"), - oid_to_hex(&complete->item->object.oid)); + oid_to_hex(&item->object.oid)); pop_most_recent_commit(&complete, COMPLETE); } } @@ -798,7 +802,6 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator, refs_for_each_rawref(get_main_ref_store(the_repository), mark_complete_oid, NULL); for_each_cached_alternate(NULL, mark_alternate_complete); - commit_list_sort_by_date(&complete); if (cutoff) mark_recent_complete_commits(args, cutoff); } @@ -1343,7 +1346,7 @@ static void write_fetch_command_and_capabilities(struct strbuf *req_buf, die(_("mismatched algorithms: client %s; server %s"), the_hash_algo->name, hash_name); packet_buf_write(req_buf, "object-format=%s", the_hash_algo->name); - } else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1) { + } else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1_LEGACY) { die(_("the server does not support algorithm '%s'"), the_hash_algo->name); } diff --git a/git-compat-util.h b/git-compat-util.h index 5bd69ec040..9408f463e3 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -897,16 +897,16 @@ static inline size_t xsize_t(off_t len) * is done via tolower(), so it is strictly ASCII (no multi-byte characters or * locale-specific conversions). */ -static inline int skip_iprefix(const char *str, const char *prefix, +static inline bool skip_iprefix(const char *str, const char *prefix, const char **out) { do { if (!*prefix) { *out = str; - return 1; + return true; } } while (tolower(*str++) == tolower(*prefix++)); - return 0; + return false; } /* @@ -914,7 +914,7 @@ static inline int skip_iprefix(const char *str, const char *prefix, * 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, +static inline bool skip_iprefix_mem(const char *buf, size_t len, const char *prefix, const char **out, size_t *outlen) { @@ -922,10 +922,10 @@ static inline int skip_iprefix_mem(const char *buf, size_t len, if (!*prefix) { *out = buf; *outlen = len; - return 1; + return true; } } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++)); - return 0; + return false; } static inline int strtoul_ui(char const *s, int base, unsigned int *result) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index c77c05edde..8bb121db4f 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -30,9 +30,7 @@ along with this program; if not, see <https://www.gnu.org/licenses/>.}] ## ## Tcl/Tk sanity check -if {[catch {package require Tcl 8.5} err] - || [catch {package require Tk 8.5} err] -} { +if {[catch {package require Tcl 8.6-8.8} err]} { catch {wm withdraw .} tk_messageBox \ -icon error \ @@ -81,10 +79,8 @@ proc is_Cygwin {} { if {[is_Windows]} { set _path_sep {;} - set _search_exe .exe } else { set _path_sep {:} - set _search_exe {} } if {[is_Windows]} { @@ -114,15 +110,15 @@ set env(PATH) [join $_search_path $_path_sep] if {[is_Windows]} { proc _which {what args} { - global _search_exe _search_path + global _search_path if {[lsearch -exact $args -script] >= 0} { set suffix {} - } elseif {[string match *$_search_exe [string tolower $what]]} { + } elseif {[string match *.exe [string tolower $what]]} { # The search string already has the file extension set suffix {} } else { - set suffix $_search_exe + set suffix .exe } foreach p $_search_path { @@ -365,7 +361,6 @@ set _appname {Git Gui} set _gitdir {} set _gitworktree {} set _isbare {} -set _gitexec {} set _githtmldir {} set _reponame {} set _shellpath {@@SHELL_PATH@@} @@ -430,20 +425,6 @@ proc gitdir {args} { return [eval [list file join $_gitdir] $args] } -proc gitexec {args} { - global _gitexec - if {$_gitexec eq {}} { - if {[catch {set _gitexec [git --exec-path]} err]} { - error "Git not installed?\n\n$err" - } - set _gitexec [file normalize $_gitexec] - } - if {$args eq {}} { - return $_gitexec - } - return [eval [list file join $_gitexec] $args] -} - proc githtmldir {args} { global _githtmldir if {$_githtmldir eq {}} { @@ -576,56 +557,6 @@ proc _trace_exec {cmd} { #'" fix poor old emacs font-lock mode -proc _git_cmd {name} { - global _git_cmd_path - - if {[catch {set v $_git_cmd_path($name)}]} { - switch -- $name { - version - - --version - - --exec-path { return [list $::_git $name] } - } - - set p [gitexec git-$name$::_search_exe] - if {[file exists $p]} { - set v [list $p] - } elseif {[is_Windows] && [file exists [gitexec git-$name]]} { - # Try to determine what sort of magic will make - # git-$name go and do its thing, because native - # Tcl on Windows doesn't know it. - # - set p [gitexec git-$name] - set f [safe_open_file $p r] - set s [gets $f] - close $f - - switch -glob -- [lindex $s 0] { - #!*sh { set i sh } - #!*perl { set i perl } - #!*python { set i python } - default { error "git-$name is not supported: $s" } - } - - upvar #0 _$i interp - if {![info exists interp]} { - set interp [_which $i] - } - if {$interp eq {}} { - error "git-$name requires $i (not in PATH)" - } - set v [concat [list $interp] [lrange $s 1 end] [list $p]] - } else { - # Assume it is builtin to git somehow and we - # aren't actually able to see a file for it. - # - set v [list $::_git $name] - } - set _git_cmd_path($name) $v - } - return $v -} - -# Run a shell command connected via pipes on stdout. # This is for use with textconv filters and uses sh -c "..." to allow it to # contain a command with arguments. We presume this # to be a shellscript that the configured shell (/bin/sh by default) knows @@ -681,30 +612,30 @@ proc safe_open_command {cmd {redir {}}} { } proc git_read {cmd {redir {}}} { - set cmdp [_git_cmd [lindex $cmd 0]] - set cmd [lrange $cmd 1 end] + global _git + set cmdp [concat [list $_git] $cmd] - return [safe_open_command [concat $cmdp $cmd] $redir] + return [safe_open_command $cmdp $redir] } proc git_read_nice {cmd} { + global _git set opt [list] _lappend_nice opt - set cmdp [_git_cmd [lindex $cmd 0]] - set cmd [lrange $cmd 1 end] + set cmdp [concat [list $_git] $cmd] - return [safe_open_command [concat $opt $cmdp $cmd]] + return [safe_open_command [concat $opt $cmdp]] } proc git_write {cmd} { + global _git set cmd [make_arglist_safe $cmd] - set cmdp [_git_cmd [lindex $cmd 0]] - set cmd [lrange $cmd 1 end] + set cmdp [concat [list $_git] $cmd] - _trace_exec [concat $cmdp $cmd] - return [open [concat [list | ] $cmdp $cmd] w] + _trace_exec $cmdp + return [open [concat [list | ] $cmdp] w] } proc githook_read {hook_name args} { @@ -744,27 +675,8 @@ proc sq {value} { proc load_current_branch {} { global current_branch is_detached - set fd [safe_open_file [gitdir HEAD] r] - fconfigure $fd -translation binary -encoding utf-8 - if {[gets $fd ref] < 1} { - set ref {} - } - close $fd - - set pfx {ref: refs/heads/} - set len [string length $pfx] - if {[string equal -length $len $pfx $ref]} { - # We're on a branch. It might not exist. But - # HEAD looks good enough to be a branch. - # - set current_branch [string range $ref $len end] - set is_detached 0 - } else { - # Assume this is a detached head. - # - set current_branch HEAD - set is_detached 1 - } + set current_branch [git branch --show-current] + set is_detached [expr [string length $current_branch] == 0] } auto_load tk_optionMenu @@ -914,18 +826,9 @@ proc apply_config {} { font configure ${font}italic -slant italic } - global use_ttk NS - set use_ttk 0 - set NS {} - if {$repo_config(gui.usettk)} { - set use_ttk [package vsatisfies [package provide Tk] 8.5] - if {$use_ttk} { - set NS ttk - bind [winfo class .] <<ThemeChanged>> [list InitTheme] - pave_toplevel . - color::sync_with_theme - } - } + bind [winfo class .] <<ThemeChanged>> [list InitTheme] + pave_toplevel . + color::sync_with_theme global comment_string set comment_string [get_config core.commentstring] @@ -992,6 +895,8 @@ if {$_git eq {}} { ## ## version check +set MIN_GIT_VERSION 2.36 + if {[catch {set _git_version [git --version]} err]} { catch {wm withdraw .} tk_messageBox \ @@ -1002,9 +907,10 @@ if {[catch {set _git_version [git --version]} err]} { $err -[appname] requires Git 1.5.0 or later." +[appname] requires Git $MIN_GIT_VERSION or later." exit 1 } + if {![regsub {^git version } $_git_version {} _git_version]} { catch {wm withdraw .} tk_messageBox \ @@ -1029,85 +935,21 @@ proc get_trimmed_version {s} { set _real_git_version $_git_version set _git_version [get_trimmed_version $_git_version] -if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} { - catch {wm withdraw .} - if {[tk_messageBox \ - -icon warning \ - -type yesno \ - -default no \ - -title "[appname]: warning" \ - -message [mc "Git version cannot be determined. - -%s claims it is version '%s'. - -%s requires at least Git 1.5.0 or later. +if {[catch {set vcheck [package vcompare $_git_version $MIN_GIT_VERSION]}] || + [expr $vcheck < 0] } { -Assume '%s' is version 1.5.0? -" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} { - set _git_version 1.5.0 - } else { - exit 1 - } -} -unset _real_git_version - -proc git-version {args} { - global _git_version - - switch [llength $args] { - 0 { - return $_git_version - } - - 2 { - set op [lindex $args 0] - set vr [lindex $args 1] - set cm [package vcompare $_git_version $vr] - return [expr $cm $op 0] - } - - 4 { - set type [lindex $args 0] - set name [lindex $args 1] - set parm [lindex $args 2] - set body [lindex $args 3] - - if {($type ne {proc} && $type ne {method})} { - error "Invalid arguments to git-version" - } - if {[llength $body] < 2 || [lindex $body end-1] ne {default}} { - error "Last arm of $type $name must be default" - } - - foreach {op vr cb} [lrange $body 0 end-2] { - if {[git-version $op $vr]} { - return [uplevel [list $type $name $parm $cb]] - } - } - - return [uplevel [list $type $name $parm [lindex $body end]]] - } - - default { - error "git-version >= x" - } - - } -} - -if {[git-version < 1.5]} { + set msg1 [mc "Insufficient git version, require: "] + set msg2 [mc "git returned:"] + set message "$msg1 $MIN_GIT_VERSION\n$msg2 $_real_git_version" catch {wm withdraw .} tk_messageBox \ -icon error \ -type ok \ -title [mc "git-gui: fatal error"] \ - -message "[appname] requires Git 1.5.0 or later. - -You are using [git-version]: - -[git --version]" + -message $message exit 1 } +unset _real_git_version ###################################################################### ## @@ -1270,11 +1112,9 @@ citool { ## ## execution environment -set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] - # Suggest our implementation of askpass, if none is set if {![info exists env(SSH_ASKPASS)]} { - set env(SSH_ASKPASS) [gitexec git-gui--askpass] + set env(SSH_ASKPASS) [file join [git --exec-path] git-gui--askpass] } ###################################################################### @@ -1295,9 +1135,23 @@ if {[catch { load_config 1 apply_config choose_repository::pick + if {![file isdirectory $_gitdir]} { + exit 1 + } set picked 1 } +# Use object format as hash algorithm (either "sha1" or "sha256") +set hashalgorithm [git rev-parse --show-object-format] +if {$hashalgorithm eq "sha1"} { + set hashlength 40 +} elseif {$hashalgorithm eq "sha256"} { + set hashlength 64 +} else { + puts stderr "Unknown hash algorithm: $hashalgorithm" + exit 1 +} + # we expand the _gitdir when it's just a single dot (i.e. when we're being # run from the .git dir itself) lest the routines to find the worktree # get confused @@ -1314,20 +1168,7 @@ if {![file isdirectory $_gitdir]} { load_config 0 apply_config -# v1.7.0 introduced --show-toplevel to return the canonical work-tree -if {[package vcompare $_git_version 1.7.0] >= 0} { - set _gitworktree [git rev-parse --show-toplevel] -} else { - # try to set work tree from environment, core.worktree or use - # cdup to obtain a relative path to the top of the worktree. If - # run from the top, the ./ prefix ensures normalize expands pwd. - if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} { - set _gitworktree [get_config core.worktree] - if {$_gitworktree eq ""} { - set _gitworktree [file normalize ./[git rev-parse --show-cdup]] - } - } -} +set _gitworktree [git rev-parse --show-toplevel] if {$_prefix ne {}} { if {$_gitworktree eq {}} { @@ -1391,8 +1232,8 @@ set is_conflict_diff 0 set last_revert {} set last_revert_enc {} -set nullid "0000000000000000000000000000000000000000" -set nullid2 "0000000000000000000000000000000000000001" +set nullid [string repeat 0 $hashlength] +set nullid2 "[string repeat 0 [expr $hashlength - 1]]1" ###################################################################### ## @@ -1553,18 +1394,7 @@ proc rescan_stage2 {fd after} { close $fd } - if {[package vcompare $::_git_version 1.6.3] >= 0} { - set ls_others [list --exclude-standard] - } else { - set ls_others [list --exclude-per-directory=.gitignore] - if {[have_info_exclude]} { - lappend ls_others "--exclude-from=[gitdir info exclude]" - } - set user_exclude [get_config core.excludesfile] - if {$user_exclude ne {} && [file readable $user_exclude]} { - lappend ls_others "--exclude-from=[file normalize $user_exclude]" - } - } + set ls_others [list --exclude-standard] set buf_rdi {} set buf_rdf {} @@ -1572,11 +1402,7 @@ proc rescan_stage2 {fd after} { set rescan_active 2 ui_status [mc "Scanning for modified files ..."] - if {[git-version >= "1.7.2"]} { - set fd_di [git_read [list diff-index --cached --ignore-submodules=dirty -z [PARENT]]] - } else { - set fd_di [git_read [list diff-index --cached -z [PARENT]]] - } + set fd_di [git_read [list diff-index --cached --ignore-submodules=dirty -z [PARENT]]] set fd_df [git_read [list diff-files -z]] fconfigure $fd_di -blocking 0 -translation binary -encoding binary @@ -1845,10 +1671,9 @@ proc short_path {path} { } set next_icon_id 0 -set null_sha1 [string repeat 0 40] proc merge_state {path new_state {head_info {}} {index_info {}}} { - global file_states next_icon_id null_sha1 + global file_states next_icon_id nullid set s0 [string index $new_state 0] set s1 [string index $new_state 1] @@ -1870,7 +1695,7 @@ proc merge_state {path new_state {head_info {}} {index_info {}}} { elseif {$s1 eq {_}} {set s1 _} if {$s0 eq {A} && $s1 eq {_} && $head_info eq {}} { - set head_info [list 0 $null_sha1] + set head_info [list 0 $nullid] } elseif {$s0 ne {_} && [string index $state 0] eq {_} && $head_info eq {}} { set head_info $index_info @@ -2323,7 +2148,7 @@ proc do_quit {{rc {1}}} { global ui_comm is_quitting repo_config commit_type global GITGUI_BCK_exists GITGUI_BCK_i global ui_comm_spell - global ret_code use_ttk + global ret_code if {$is_quitting} return set is_quitting 1 @@ -2381,13 +2206,8 @@ proc do_quit {{rc {1}}} { } set cfg_geometry [list] lappend cfg_geometry [wm geometry .] - if {$use_ttk} { - lappend cfg_geometry [.vpane sashpos 0] - lappend cfg_geometry [.vpane.files sashpos 0] - } else { - lappend cfg_geometry [lindex [.vpane sash coord 0] 0] - lappend cfg_geometry [lindex [.vpane.files sash coord 0] 1] - } + lappend cfg_geometry [.vpane sashpos 0] + lappend cfg_geometry [.vpane.files sashpos 0] if {[catch {set rc_geometry $repo_config(gui.geometry)}]} { set rc_geometry {} } @@ -3203,7 +3023,7 @@ blame { if {$head eq {}} { load_current_branch } else { - if {[regexp {^[0-9a-f]{1,39}$} $head]} { + if {[regexp [string map "@@ [expr $hashlength - 1]" {^[0-9a-f]{1,@@}$}] $head]} { if {[catch { set head [git rev-parse --verify $head] } err]} { @@ -3269,13 +3089,12 @@ default { # -- Branch Control # -${NS}::frame .branch -if {!$use_ttk} {.branch configure -borderwidth 1 -relief sunken} -${NS}::label .branch.l1 \ +ttk::frame .branch +ttk::label .branch.l1 \ -text [mc "Current Branch:"] \ -anchor w \ -justify left -${NS}::label .branch.cb \ +ttk::label .branch.cb \ -textvariable current_branch \ -anchor w \ -justify left @@ -3285,13 +3104,9 @@ pack .branch -side top -fill x # -- Main Window Layout # -${NS}::panedwindow .vpane -orient horizontal -${NS}::panedwindow .vpane.files -orient vertical -if {$use_ttk} { - .vpane add .vpane.files -} else { - .vpane add .vpane.files -sticky nsew -height 100 -width 200 -} +ttk::panedwindow .vpane -orient horizontal +ttk::panedwindow .vpane.files -orient vertical +.vpane add .vpane.files pack .vpane -anchor n -side top -fill both -expand 1 # -- Working Directory File List @@ -3308,8 +3123,8 @@ ttext $ui_workdir \ -xscrollcommand {.vpane.files.workdir.sx set} \ -yscrollcommand {.vpane.files.workdir.sy set} \ -state disabled -${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview] -${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview] +ttk::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview] +ttk::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview] pack .vpane.files.workdir.title -side top -fill x pack .vpane.files.workdir.sx -side bottom -fill x pack .vpane.files.workdir.sy -side right -fill y @@ -3330,8 +3145,8 @@ ttext $ui_index \ -xscrollcommand {.vpane.files.index.sx set} \ -yscrollcommand {.vpane.files.index.sy set} \ -state disabled -${NS}::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview] -${NS}::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview] +ttk::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview] +ttk::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview] pack .vpane.files.index.title -side top -fill x pack .vpane.files.index.sx -side bottom -fill x pack .vpane.files.index.sy -side right -fill y @@ -3341,10 +3156,6 @@ pack $ui_index -side left -fill both -expand 1 # .vpane.files add .vpane.files.workdir .vpane.files add .vpane.files.index -if {!$use_ttk} { - .vpane.files paneconfigure .vpane.files.workdir -sticky news - .vpane.files paneconfigure .vpane.files.index -sticky news -} proc set_selection_colors {w has_focus} { foreach tag [list in_diff in_sel] { @@ -3365,78 +3176,63 @@ unset i # -- Diff and Commit Area # -if {$have_tk85} { - ${NS}::panedwindow .vpane.lower -orient vertical - ${NS}::frame .vpane.lower.commarea - ${NS}::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500 - .vpane.lower add .vpane.lower.diff - .vpane.lower add .vpane.lower.commarea - .vpane add .vpane.lower - if {$use_ttk} { - .vpane.lower pane .vpane.lower.diff -weight 1 - .vpane.lower pane .vpane.lower.commarea -weight 0 - } else { - .vpane.lower paneconfigure .vpane.lower.diff -stretch always - .vpane.lower paneconfigure .vpane.lower.commarea -stretch never - } -} else { - frame .vpane.lower -height 300 -width 400 - frame .vpane.lower.commarea - frame .vpane.lower.diff -relief sunken -borderwidth 1 - pack .vpane.lower.diff -fill both -expand 1 - pack .vpane.lower.commarea -side bottom -fill x - .vpane add .vpane.lower - .vpane paneconfigure .vpane.lower -sticky nsew -} +ttk::panedwindow .vpane.lower -orient vertical +ttk::frame .vpane.lower.commarea +ttk::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500 +.vpane.lower add .vpane.lower.diff +.vpane.lower add .vpane.lower.commarea +.vpane add .vpane.lower +.vpane.lower pane .vpane.lower.diff -weight 1 +.vpane.lower pane .vpane.lower.commarea -weight 0 # -- Commit Area Buttons # -${NS}::frame .vpane.lower.commarea.buttons -${NS}::label .vpane.lower.commarea.buttons.l -text {} \ +ttk::frame .vpane.lower.commarea.buttons +ttk::label .vpane.lower.commarea.buttons.l -text {} \ -anchor w \ -justify left pack .vpane.lower.commarea.buttons.l -side top -fill x pack .vpane.lower.commarea.buttons -side left -fill y -${NS}::button .vpane.lower.commarea.buttons.rescan -text [mc Rescan] \ +ttk::button .vpane.lower.commarea.buttons.rescan -text [mc Rescan] \ -command ui_do_rescan pack .vpane.lower.commarea.buttons.rescan -side top -fill x lappend disable_on_lock \ {.vpane.lower.commarea.buttons.rescan conf -state} -${NS}::button .vpane.lower.commarea.buttons.incall -text [mc "Stage Changed"] \ +ttk::button .vpane.lower.commarea.buttons.incall -text [mc "Stage Changed"] \ -command do_add_all pack .vpane.lower.commarea.buttons.incall -side top -fill x lappend disable_on_lock \ {.vpane.lower.commarea.buttons.incall conf -state} if {![is_enabled nocommitmsg]} { - ${NS}::button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \ + ttk::button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \ -command do_signoff pack .vpane.lower.commarea.buttons.signoff -side top -fill x } -${NS}::button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \ +ttk::button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \ -command do_commit pack .vpane.lower.commarea.buttons.commit -side top -fill x lappend disable_on_lock \ {.vpane.lower.commarea.buttons.commit conf -state} if {![is_enabled nocommit]} { - ${NS}::button .vpane.lower.commarea.buttons.push -text [mc Push] \ + ttk::button .vpane.lower.commarea.buttons.push -text [mc Push] \ -command do_push_anywhere pack .vpane.lower.commarea.buttons.push -side top -fill x } # -- Commit Message Buffer # -${NS}::frame .vpane.lower.commarea.buffer -${NS}::frame .vpane.lower.commarea.buffer.header +ttk::frame .vpane.lower.commarea.buffer +ttk::frame .vpane.lower.commarea.buffer.header set ui_comm .vpane.lower.commarea.buffer.frame.t set ui_coml .vpane.lower.commarea.buffer.header.l if {![is_enabled nocommit]} { - ${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \ + ttk::checkbutton .vpane.lower.commarea.buffer.header.amend \ -text [mc "Amend Last Commit"] \ -variable commit_type_is_amend \ -command do_select_commit_type @@ -3444,7 +3240,7 @@ if {![is_enabled nocommit]} { [list .vpane.lower.commarea.buffer.header.amend conf -state] } -${NS}::label $ui_coml \ +ttk::label $ui_coml \ -anchor w \ -justify left proc trace_commit_type {varname args} { @@ -3479,10 +3275,10 @@ ttext $ui_comm \ -font font_diff \ -xscrollcommand {.vpane.lower.commarea.buffer.frame.sbx set} \ -yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set} -${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sbx \ +ttk::scrollbar .vpane.lower.commarea.buffer.frame.sbx \ -orient horizontal \ -command [list $ui_comm xview] -${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \ +ttk::scrollbar .vpane.lower.commarea.buffer.frame.sby \ -orient vertical \ -command [list $ui_comm yview] @@ -3605,9 +3401,9 @@ ttext $ui_diff \ -yscrollcommand {.vpane.lower.diff.body.sby set} \ -state disabled catch {$ui_diff configure -tabstyle wordprocessor} -${NS}::scrollbar .vpane.lower.diff.body.sbx -orient horizontal \ +ttk::scrollbar .vpane.lower.diff.body.sbx -orient horizontal \ -command [list $ui_diff xview] -${NS}::scrollbar .vpane.lower.diff.body.sby -orient vertical \ +ttk::scrollbar .vpane.lower.diff.body.sby -orient vertical \ -command [list $ui_diff yview] pack .vpane.lower.diff.body.sbx -side bottom -fill x pack .vpane.lower.diff.body.sby -side right -fill y @@ -3908,29 +3704,14 @@ proc on_ttk_pane_mapped {w pane pos} { bind $w <Map> {} after 0 [list after idle [list $w sashpos $pane $pos]] } -proc on_tk_pane_mapped {w pane x y} { - bind $w <Map> {} - after 0 [list after idle [list $w sash place $pane $x $y]] -} proc on_application_mapped {} { - global repo_config use_ttk + global repo_config bind . <Map> {} set gm $repo_config(gui.geometry) - if {$use_ttk} { - bind .vpane <Map> \ - [list on_ttk_pane_mapped %W 0 [lindex $gm 1]] - bind .vpane.files <Map> \ - [list on_ttk_pane_mapped %W 0 [lindex $gm 2]] - } else { - bind .vpane <Map> \ - [list on_tk_pane_mapped %W 0 \ - [lindex $gm 1] \ - [lindex [.vpane sash coord 0] 1]] - bind .vpane.files <Map> \ - [list on_tk_pane_mapped %W 0 \ - [lindex [.vpane.files sash coord 0] 0] \ - [lindex $gm 2]] - } + bind .vpane <Map> \ + [list on_ttk_pane_mapped %W 0 [lindex $gm 1]] + bind .vpane.files <Map> \ + [list on_ttk_pane_mapped %W 0 [lindex $gm 2]] wm geometry . [lindex $gm 0] } if {[info exists repo_config(gui.geometry)]} { diff --git a/git-gui/lib/about.tcl b/git-gui/lib/about.tcl index cfa50fca87..122ebfb71d 100644 --- a/git-gui/lib/about.tcl +++ b/git-gui/lib/about.tcl @@ -4,19 +4,19 @@ proc do_about {} { global appvers copyright oguilib global tcl_patchLevel tk_patchLevel - global ui_comm_spell NS use_ttk + global ui_comm_spell set w .about_dialog Dialog $w wm geometry $w "+[winfo rootx .]+[winfo rooty .]" pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10 - ${NS}::label $w.header -text [mc "About %s" [appname]] \ + ttk::label $w.header -text [mc "About %s" [appname]] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.close -text {Close} \ + ttk::frame $w.buttons + ttk::button $w.buttons.close -text {Close} \ -default active \ -command [list destroy $w] pack $w.buttons.close -side right @@ -44,7 +44,7 @@ proc do_about {} { set d {} append d "git wrapper: $::_git\n" - append d "git exec dir: [gitexec]\n" + append d "git exec dir: [git --exec-path]\n" append d "git-gui lib: $oguilib" paddedlabel $w.vers -text $v diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl index d6fd8bea91..9d4d1ac872 100644 --- a/git-gui/lib/blame.tcl +++ b/git-gui/lib/blame.tcl @@ -63,7 +63,7 @@ field tooltip_timer {} ; # Current timer event for our tooltip field tooltip_commit {} ; # Commit(s) in tooltip constructor new {i_commit i_path i_jump} { - global cursor_ptr M1B M1T have_tk85 use_ttk NS + global cursor_ptr M1B M1T variable active_color variable group_colors @@ -203,18 +203,17 @@ constructor new {i_commit i_path i_jump} { -width 80 \ -xscrollcommand [list $w.file_pane.out.sbx set] \ -font font_diff - if {$have_tk85} { $w_file configure -inactiveselectbackground darkblue - } + $w_file tag conf found \ -background yellow set w_columns [list $w_amov $w_asim $w_line $w_file] - ${NS}::scrollbar $w.file_pane.out.sbx \ + ttk::scrollbar $w.file_pane.out.sbx \ -orient h \ -command [list $w_file xview] - ${NS}::scrollbar $w.file_pane.out.sby \ + ttk::scrollbar $w.file_pane.out.sby \ -orient v \ -command [list scrollbar2many $w_columns yview] eval grid $w_columns $w.file_pane.out.sby -sticky nsew @@ -264,10 +263,10 @@ constructor new {i_commit i_path i_jump} { -background $active_color \ -font font_ui $w_cviewer tag raise sel - ${NS}::scrollbar $w.file_pane.cm.sbx \ + ttk::scrollbar $w.file_pane.cm.sbx \ -orient h \ -command [list $w_cviewer xview] - ${NS}::scrollbar $w.file_pane.cm.sby \ + ttk::scrollbar $w.file_pane.cm.sby \ -orient v \ -command [list $w_cviewer yview] pack $w.file_pane.cm.sby -side right -fill y @@ -426,6 +425,7 @@ method _kill {} { method _load {jump} { variable group_colors + global hashlength _hide_tooltip $this @@ -436,7 +436,7 @@ method _load {jump} { $i conf -state normal $i delete 0.0 end foreach g [$i tag names] { - if {[regexp {^g[0-9a-f]{40}$} $g]} { + if {[regexp [string map "@@ $hashlength" {^g[0-9a-f]{@@}$}] $g]} { $i tag delete $g } } @@ -470,7 +470,7 @@ method _load {jump} { $w_path conf -text [escape_path $path] set do_textconv 0 - if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} { + if {![is_config_false gui.textconv]} { set filter [gitattr $path diff set] set textconv [get_config [join [list diff $filter textconv] .]] if {$filter ne {set} && $textconv ne {}} { @@ -500,6 +500,8 @@ method _load {jump} { } method _history_menu {} { + global hashlength + set m $w.backmenu if {[winfo exists $m]} { $m delete 0 end @@ -513,7 +515,7 @@ method _history_menu {} { set c [lindex $e 0] set f [lindex $e 1] - if {[regexp {^[0-9a-f]{40}$} $c]} { + if {[regexp [string map "@@ $hashlength" {^[0-9a-f]{@@}$}] $c]} { set t [string range $c 0 8]... } elseif {$c eq {}} { set t {Working Directory} @@ -627,6 +629,7 @@ method _exec_blame {cur_w cur_d options cur_s} { method _read_blame {fd cur_w cur_d} { upvar #0 $cur_d line_data variable group_colors + global hashlength nullid if {$fd ne $current_fd} { catch {close $fd} @@ -635,7 +638,7 @@ method _read_blame {fd cur_w cur_d} { $cur_w conf -state normal while {[gets $fd line] >= 0} { - if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \ + if {[regexp [string map "@@ $hashlength" {^([a-z0-9]{@@}) (\d+) (\d+) (\d+)$}] $line line \ cmit original_line final_line line_count]} { set r_commit $cmit set r_orig_line $original_line @@ -648,7 +651,7 @@ method _read_blame {fd cur_w cur_d} { set oln $r_orig_line set cmit $r_commit - if {[regexp {^0{40}$} $cmit]} { + if {$cmit eq $nullid} { set commit_abbr work set commit_type curr_commit } elseif {$cmit eq $commit} { @@ -807,9 +810,7 @@ method _read_blame {fd cur_w cur_d} { # thorough copy search; insert before the threshold set original_options [linsert $original_options 0 -C] } - if {[git-version >= 1.5.3]} { - lappend original_options -w ; # ignore indentation changes - } + lappend original_options -w ; # ignore indentation changes _exec_blame $this $w_amov @amov_data \ $original_options \ @@ -857,9 +858,7 @@ method _fullcopyblame {} { set threshold [get_config gui.copyblamethreshold] set original_options [list -C -C "-C$threshold"] - if {[git-version >= 1.5.3]} { - lappend original_options -w ; # ignore indentation changes - } + lappend original_options -w ; # ignore indentation changes # Find the line range set pos @$::cursorX,$::cursorY @@ -1298,7 +1297,7 @@ method _open_tooltip {cur_w} { # On MacOS raising a window causes it to acquire focus. # Tk 8.5 on MacOS seems to properly support wm transient, # so we can safely counter the effect there. - if {$::have_tk85 && [is_MacOSX]} { + if {[is_MacOSX]} { update if {$w eq {}} { raise . diff --git a/git-gui/lib/branch_checkout.tcl b/git-gui/lib/branch_checkout.tcl index d06037decc..1e6b757b35 100644 --- a/git-gui/lib/branch_checkout.tcl +++ b/git-gui/lib/branch_checkout.tcl @@ -10,7 +10,6 @@ field opt_fetch 1; # refetch tracking branch if used? field opt_detach 0; # force a detached head case? constructor dialog {} { - global use_ttk NS make_dialog top w wm withdraw $w wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]] @@ -18,16 +17,16 @@ constructor dialog {} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } - ${NS}::label $w.header -text [mc "Checkout Branch"] \ + ttk::label $w.header -text [mc "Checkout Branch"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.create -text [mc Checkout] \ + ttk::frame $w.buttons + ttk::button $w.buttons.create -text [mc Checkout] \ -default active \ -command [cb _checkout] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 @@ -36,14 +35,14 @@ constructor dialog {} { $w_rev bind_listbox <Double-Button-1> [cb _checkout] pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5 - ${NS}::labelframe $w.options -text [mc Options] + ttk::labelframe $w.options -text [mc Options] - ${NS}::checkbutton $w.options.fetch \ + ttk::checkbutton $w.options.fetch \ -text [mc "Fetch Tracking Branch"] \ -variable @opt_fetch pack $w.options.fetch -anchor nw - ${NS}::checkbutton $w.options.detach \ + ttk::checkbutton $w.options.detach \ -text [mc "Detach From Local Branch"] \ -variable @opt_detach pack $w.options.detach -anchor nw diff --git a/git-gui/lib/branch_create.tcl b/git-gui/lib/branch_create.tcl index ba367d551d..9fded28b5c 100644 --- a/git-gui/lib/branch_create.tcl +++ b/git-gui/lib/branch_create.tcl @@ -16,7 +16,7 @@ field opt_fetch 1; # refetch tracking branch if used? field reset_ok 0; # did the user agree to reset? constructor dialog {} { - global repo_config use_ttk NS + global repo_config make_dialog top w wm withdraw $w @@ -25,39 +25,37 @@ constructor dialog {} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } - ${NS}::label $w.header -text [mc "Create New Branch"] \ + ttk::label $w.header -text [mc "Create New Branch"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.create -text [mc Create] \ + ttk::frame $w.buttons + ttk::button $w.buttons.create -text [mc Create] \ -default active \ -command [cb _create] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.desc -text [mc "Branch Name"] - ${NS}::radiobutton $w.desc.name_r \ + ttk::labelframe $w.desc -text [mc "Branch Name"] + ttk::radiobutton $w.desc.name_r \ -text [mc "Name:"] \ -value user \ -variable @name_type - if {!$use_ttk} {$w.desc.name_r configure -anchor w} set w_name $w.desc.name_t - ${NS}::entry $w_name \ + ttk::entry $w_name \ -width 40 \ -textvariable @name \ -validate key \ -validatecommand [cb _validate %d %S] grid $w.desc.name_r $w_name -sticky we -padx {0 5} - ${NS}::radiobutton $w.desc.match_r \ + ttk::radiobutton $w.desc.match_r \ -text [mc "Match Tracking Branch Name"] \ -value match \ -variable @name_type - if {!$use_ttk} {$w.desc.match_r configure -anchor w} grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2 grid columnconfigure $w.desc 1 -weight 1 @@ -66,34 +64,34 @@ constructor dialog {} { set w_rev [::choose_rev::new $w.rev [mc "Starting Revision"]] pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5 - ${NS}::labelframe $w.options -text [mc Options] + ttk::labelframe $w.options -text [mc Options] - ${NS}::frame $w.options.merge - ${NS}::label $w.options.merge.l -text [mc "Update Existing Branch:"] + ttk::frame $w.options.merge + ttk::label $w.options.merge.l -text [mc "Update Existing Branch:"] pack $w.options.merge.l -side left - ${NS}::radiobutton $w.options.merge.no \ + ttk::radiobutton $w.options.merge.no \ -text [mc No] \ -value none \ -variable @opt_merge pack $w.options.merge.no -side left - ${NS}::radiobutton $w.options.merge.ff \ + ttk::radiobutton $w.options.merge.ff \ -text [mc "Fast Forward Only"] \ -value ff \ -variable @opt_merge pack $w.options.merge.ff -side left - ${NS}::radiobutton $w.options.merge.reset \ + ttk::radiobutton $w.options.merge.reset \ -text [mc Reset] \ -value reset \ -variable @opt_merge pack $w.options.merge.reset -side left pack $w.options.merge -anchor nw - ${NS}::checkbutton $w.options.fetch \ + ttk::checkbutton $w.options.fetch \ -text [mc "Fetch Tracking Branch"] \ -variable @opt_fetch pack $w.options.fetch -anchor nw - ${NS}::checkbutton $w.options.checkout \ + ttk::checkbutton $w.options.checkout \ -text [mc "Checkout After Creation"] \ -variable @opt_checkout pack $w.options.checkout -anchor nw diff --git a/git-gui/lib/branch_delete.tcl b/git-gui/lib/branch_delete.tcl index a5051637bb..deac74a644 100644 --- a/git-gui/lib/branch_delete.tcl +++ b/git-gui/lib/branch_delete.tcl @@ -9,7 +9,7 @@ field w_check ; # revision picker for merge test field w_delete ; # delete button constructor dialog {} { - global current_branch use_ttk NS + global current_branch make_dialog top w wm withdraw $w @@ -18,25 +18,25 @@ constructor dialog {} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } - ${NS}::label $w.header -text [mc "Delete Local Branch"] \ + ttk::label $w.header -text [mc "Delete Local Branch"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons + ttk::frame $w.buttons set w_delete $w.buttons.delete - ${NS}::button $w_delete \ + ttk::button $w_delete \ -text [mc Delete] \ -default active \ -state disabled \ -command [cb _delete] pack $w_delete -side right - ${NS}::button $w.buttons.cancel \ + ttk::button $w.buttons.cancel \ -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.list -text [mc "Local Branches"] + ttk::labelframe $w.list -text [mc "Local Branches"] set w_heads $w.list.l slistbox $w_heads \ -height 10 \ diff --git a/git-gui/lib/branch_rename.tcl b/git-gui/lib/branch_rename.tcl index 3a2d79a9cc..7a3b39d6a3 100644 --- a/git-gui/lib/branch_rename.tcl +++ b/git-gui/lib/branch_rename.tcl @@ -8,7 +8,7 @@ field oldname field newname constructor dialog {} { - global current_branch use_ttk NS + global current_branch make_dialog top w wm withdraw $w @@ -20,31 +20,27 @@ constructor dialog {} { set oldname $current_branch set newname [get_config gui.newbranchtemplate] - ${NS}::label $w.header -text [mc "Rename Branch"]\ + ttk::label $w.header -text [mc "Rename Branch"]\ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.rename -text [mc Rename] \ + ttk::frame $w.buttons + ttk::button $w.buttons.rename -text [mc Rename] \ -default active \ -command [cb _rename] pack $w.buttons.rename -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::frame $w.rename - ${NS}::label $w.rename.oldname_l -text [mc "Branch:"] - if {$use_ttk} { - ttk::combobox $w.rename.oldname_m -textvariable @oldname \ - -values [load_all_heads] -state readonly - } else { - eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads] - } + ttk::frame $w.rename + ttk::label $w.rename.oldname_l -text [mc "Branch:"] + ttk::combobox $w.rename.oldname_m -textvariable @oldname \ + -values [load_all_heads] -state readonly - ${NS}::label $w.rename.newname_l -text [mc "New Name:"] - ${NS}::entry $w.rename.newname_t \ + ttk::label $w.rename.newname_l -text [mc "New Name:"] + ttk::entry $w.rename.newname_t \ -width 40 \ -textvariable @newname \ -validate key \ diff --git a/git-gui/lib/browser.tcl b/git-gui/lib/browser.tcl index 6fc8d4d637..f53eb952cf 100644 --- a/git-gui/lib/browser.tcl +++ b/git-gui/lib/browser.tcl @@ -21,7 +21,7 @@ field browser_busy 1 field ls_buf {}; # Buffered record output from ls-tree constructor new {commit {path {}}} { - global cursor_ptr M1B use_ttk NS + global cursor_ptr M1B make_dialog top w wm withdraw $top wm title $top [mc "%s (%s): File Browser" [appname] [reponame]] @@ -35,15 +35,14 @@ constructor new {commit {path {}}} { set browser_commit $commit set browser_path "$browser_commit:[escape_path $path]" - ${NS}::label $w.path \ + ttk::label $w.path \ -textvariable @browser_path \ -anchor w \ -justify left \ -font font_uibold - if {!$use_ttk} { $w.path configure -borderwidth 1 -relief sunken} pack $w.path -anchor w -side top -fill x - ${NS}::frame $w.list + ttk::frame $w.list set w_list $w.list.l text $w_list -background white -foreground black \ -borderwidth 0 \ @@ -55,18 +54,17 @@ constructor new {commit {path {}}} { -xscrollcommand [list $w.list.sbx set] \ -yscrollcommand [list $w.list.sby set] rmsel_tag $w_list - ${NS}::scrollbar $w.list.sbx -orient h -command [list $w_list xview] - ${NS}::scrollbar $w.list.sby -orient v -command [list $w_list yview] + ttk::scrollbar $w.list.sbx -orient h -command [list $w_list xview] + ttk::scrollbar $w.list.sby -orient v -command [list $w_list yview] pack $w.list.sbx -side bottom -fill x pack $w.list.sby -side right -fill y pack $w_list -side left -fill both -expand 1 pack $w.list -side top -fill both -expand 1 - ${NS}::label $w.status \ + ttk::label $w.status \ -textvariable @browser_status \ -anchor w \ -justify left - if {!$use_ttk} { $w.status configure -borderwidth 1 -relief sunken} pack $w.status -anchor w -side bottom -fill x bind $w_list <Button-1> "[cb _click 0 @%x,%y];break" @@ -269,7 +267,6 @@ field w ; # widget path field w_rev ; # mega-widget to pick the initial revision constructor dialog {} { - global use_ttk NS make_dialog top w wm withdraw $top wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]] @@ -278,18 +275,18 @@ constructor dialog {} { wm transient $top . } - ${NS}::label $w.header \ + ttk::label $w.header \ -text [mc "Browse Branch Files"] \ -font font_uibold \ -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.browse -text [mc Browse] \ + ttk::frame $w.buttons + ttk::button $w.buttons.browse -text [mc Browse] \ -default active \ -command [cb _open] pack $w.buttons.browse -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 diff --git a/git-gui/lib/checkout_op.tcl b/git-gui/lib/checkout_op.tcl index 87ed0b4858..987486a4b6 100644 --- a/git-gui/lib/checkout_op.tcl +++ b/git-gui/lib/checkout_op.tcl @@ -151,7 +151,7 @@ method _finish_fetch {ok} { } method _update_ref {} { - global null_sha1 current_branch repo_config + global nullid current_branch repo_config set ref $new_ref set new $new_hash @@ -177,7 +177,7 @@ method _update_ref {} { } set reflog_msg "branch: Created from $new_expr" - set cur $null_sha1 + set cur $nullid if {($repo_config(branch.autosetupmerge) eq {true} || $repo_config(branch.autosetupmerge) eq {always}) diff --git a/git-gui/lib/choose_font.tcl b/git-gui/lib/choose_font.tcl index ebe50bd7d0..a90908a8ec 100644 --- a/git-gui/lib/choose_font.tcl +++ b/git-gui/lib/choose_font.tcl @@ -17,7 +17,6 @@ variable all_families [list] ; # All fonts known to Tk constructor pick {path title a_family a_size} { variable all_families - global use_ttk NS set v_family $a_family set v_size $a_size @@ -33,25 +32,25 @@ constructor pick {path title a_family a_size} { wm title $top "[appname] ([reponame]): $title" wm geometry $top "+[winfo rootx $path]+[winfo rooty $path]" - ${NS}::label $w.header -text $title -font font_uibold -anchor center + ttk::label $w.header -text $title -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.select \ + ttk::frame $w.buttons + ttk::button $w.buttons.select \ -text [mc Select] \ -default active \ -command [cb _select] - ${NS}::button $w.buttons.cancel \ + ttk::button $w.buttons.cancel \ -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.select -side right pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::frame $w.inner + ttk::frame $w.inner - ${NS}::frame $w.inner.family - ${NS}::label $w.inner.family.l \ + ttk::frame $w.inner.family + ttk::label $w.inner.family.l \ -text [mc "Font Family"] \ -anchor w set w_family $w.inner.family.v @@ -66,13 +65,13 @@ constructor pick {path title a_family a_size} { -height 10 \ -yscrollcommand [list $w.inner.family.sby set] rmsel_tag $w_family - ${NS}::scrollbar $w.inner.family.sby -command [list $w_family yview] + ttk::scrollbar $w.inner.family.sby -command [list $w_family yview] pack $w.inner.family.l -side top -fill x pack $w.inner.family.sby -side right -fill y pack $w_family -fill both -expand 1 - ${NS}::frame $w.inner.size - ${NS}::label $w.inner.size.l \ + ttk::frame $w.inner.size + ttk::label $w.inner.size.l \ -text [mc "Font Size"] \ -anchor w tspinbox $w.inner.size.v \ @@ -88,8 +87,8 @@ constructor pick {path title a_family a_size} { grid columnconfigure $w.inner 0 -weight 1 pack $w.inner -fill both -expand 1 -padx 5 -pady 5 - ${NS}::frame $w.example - ${NS}::label $w.example.l \ + ttk::frame $w.example + ttk::label $w.example.l \ -text [mc "Font Example"] \ -anchor w set w_example $w.example.t diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl index 5b361cc424..7e1462a20c 100644 --- a/git-gui/lib/choose_repository.tcl +++ b/git-gui/lib/choose_repository.tcl @@ -10,22 +10,12 @@ field w_next ; # Next button field w_quit ; # Quit button field o_cons ; # Console object (if active) -# Status mega-widget instance during _do_clone2 (used by _copy_files and -# _link_files). Widget is destroyed before _do_clone2 calls -# _do_clone_checkout -field o_status - -# Operation displayed by status mega-widget during _do_clone_checkout => -# _readtree_wait => _postcheckout_wait => _do_clone_submodules => -# _do_validate_submodule_cloning. The status mega-widget is a different -# instance than that stored in $o_status in earlier operations. -field o_status_op - field w_types ; # List of type buttons in clone field w_recentlist ; # Listbox containing recent repositories field w_localpath ; # Entry widget bound to local_path field done 0 ; # Finished picking the repository? +field clone_ok false ; # clone succeeeded field local_path {} ; # Where this repository is locally field origin_url {} ; # Where we are cloning from field origin_name origin ; # What we shall call 'origin' @@ -35,7 +25,7 @@ field readtree_err ; # Error output from read-tree (if any) field sorted_recent ; # recent repositories (sorted) constructor pick {} { - global M1T M1B use_ttk NS + global M1T M1B if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} { set maxrecent 10 @@ -88,7 +78,7 @@ constructor pick {} { set w_body $w.body set opts $w_body.options - ${NS}::frame $w_body + ttk::frame $w_body text $opts \ -cursor $::cursor_ptr \ -relief flat \ @@ -158,8 +148,8 @@ constructor pick {} { set lenrecent $maxrecent } - ${NS}::label $w_body.space - ${NS}::label $w_body.recentlabel \ + ttk::label $w_body.space + ttk::label $w_body.recentlabel \ -anchor w \ -text [mc "Open Recent Repository:"] set w_recentlist $w_body.recentlist @@ -199,10 +189,10 @@ constructor pick {} { } pack $w_body -fill x -padx 10 -pady 10 - ${NS}::frame $w.buttons + ttk::frame $w.buttons set w_next $w.buttons.next set w_quit $w.buttons.quit - ${NS}::button $w_quit \ + ttk::button $w_quit \ -text [mc "Quit"] \ -command exit pack $w_quit -side right -padx 5 @@ -303,10 +293,9 @@ method _open_recent_path {p} { } method _next {action} { - global NS destroy $w_body if {![winfo exists $w_next]} { - ${NS}::button $w_next -default active + ttk::button $w_next -default active set pos -before if {[tk windowingsystem] eq "win32"} { set pos -after } pack $w_next -side right -padx 5 $pos $w_quit @@ -323,7 +312,7 @@ method _write_local_path {args} { } method _git_init {} { - if {[catch {file mkdir $local_path} err]} { + if {[catch {git init $local_path} err]} { error_popup [strcat \ [mc "Failed to create repository %s:" $local_path] \ "\n\n$err"] @@ -337,13 +326,6 @@ method _git_init {} { return 0 } - if {[catch {git init} err]} { - error_popup [strcat \ - [mc "Failed to create repository %s:" $local_path] \ - "\n\n$err"] - return 0 - } - _append_recentrepos [pwd] set ::_gitdir .git set ::_prefix {} @@ -360,44 +342,29 @@ proc _is_git {path {outdir_var ""}} { return 1 } -proc _objdir {path} { - set objdir [file join $path .git objects] - if {[file isdirectory $objdir]} { - return $objdir - } - - set objdir [file join $path objects] - if {[file isdirectory $objdir]} { - return $objdir - } - - return {} -} - ###################################################################### ## ## Create New Repository method _do_new {} { - global use_ttk NS $w_next conf \ -state disabled \ -command [cb _do_new2] \ -text [mc "Create"] - ${NS}::frame $w_body - ${NS}::label $w_body.h \ + ttk::frame $w_body + ttk::label $w_body.h \ -font font_uibold -anchor center \ -text [mc "Create New Repository"] pack $w_body.h -side top -fill x -pady 10 pack $w_body -fill x -padx 10 - ${NS}::frame $w_body.where - ${NS}::label $w_body.where.l -text [mc "Directory:"] - ${NS}::entry $w_body.where.t \ + ttk::frame $w_body.where + ttk::label $w_body.where.l -text [mc "Directory:"] + ttk::entry $w_body.where.t \ -textvariable @local_path \ -width 50 - ${NS}::button $w_body.where.b \ + ttk::button $w_body.where.b \ -text [mc "Browse"] \ -command [cb _new_local_path] set w_localpath $w_body.where.t @@ -463,56 +430,55 @@ proc _new_ok {p} { ## Clone Existing Repository method _do_clone {} { - global use_ttk NS $w_next conf \ -state disabled \ -command [cb _do_clone2] \ -text [mc "Clone"] - ${NS}::frame $w_body - ${NS}::label $w_body.h \ + ttk::frame $w_body + ttk::label $w_body.h \ -font font_uibold -anchor center \ -text [mc "Clone Existing Repository"] pack $w_body.h -side top -fill x -pady 10 pack $w_body -fill x -padx 10 set args $w_body.args - ${NS}::frame $w_body.args + ttk::frame $w_body.args pack $args -fill both - ${NS}::label $args.origin_l -text [mc "Source Location:"] - ${NS}::entry $args.origin_t \ + ttk::label $args.origin_l -text [mc "Source Location:"] + ttk::entry $args.origin_t \ -textvariable @origin_url \ -width 50 - ${NS}::button $args.origin_b \ + ttk::button $args.origin_b \ -text [mc "Browse"] \ -command [cb _open_origin] grid $args.origin_l $args.origin_t $args.origin_b -sticky ew - ${NS}::label $args.where_l -text [mc "Target Directory:"] - ${NS}::entry $args.where_t \ + ttk::label $args.where_l -text [mc "Target Directory:"] + ttk::entry $args.where_t \ -textvariable @local_path \ -width 50 - ${NS}::button $args.where_b \ + ttk::button $args.where_b \ -text [mc "Browse"] \ -command [cb _new_local_path] grid $args.where_l $args.where_t $args.where_b -sticky ew set w_localpath $args.where_t - ${NS}::label $args.type_l -text [mc "Clone Type:"] - ${NS}::frame $args.type_f + ttk::label $args.type_l -text [mc "Clone Type:"] + ttk::frame $args.type_f set w_types [list] - lappend w_types [${NS}::radiobutton $args.type_f.hardlink \ + lappend w_types [ttk::radiobutton $args.type_f.hardlink \ -state disabled \ -text [mc "Standard (Fast, Semi-Redundant, Hardlinks)"] \ -variable @clone_type \ -value hardlink] - lappend w_types [${NS}::radiobutton $args.type_f.full \ + lappend w_types [ttk::radiobutton $args.type_f.full \ -state disabled \ -text [mc "Full Copy (Slower, Redundant Backup)"] \ -variable @clone_type \ -value full] - lappend w_types [${NS}::radiobutton $args.type_f.shared \ + lappend w_types [ttk::radiobutton $args.type_f.shared \ -state disabled \ -text [mc "Shared (Fastest, Not Recommended, No Backup)"] \ -variable @clone_type \ @@ -520,7 +486,7 @@ method _do_clone {} { foreach r $w_types { pack $r -anchor w } - ${NS}::checkbutton $args.type_f.recursive \ + ttk::checkbutton $args.type_f.recursive \ -text [mc "Recursively clone submodules too"] \ -variable @recursive \ -onvalue true -offvalue false @@ -588,6 +554,25 @@ method _update_clone {args} { method _do_clone2 {} { if {[file isdirectory $origin_url]} { set origin_url [file normalize $origin_url] + if {$clone_type eq {hardlink}} { + # cannot use hardlinks if this is a linked worktree (.gitfile or git-new-workdir) + if {[git -C $origin_url rev-parse --is-inside-work-tree] == {true}} { + set islink 0 + set dotgit [file join $origin_url .git] + if {[file isfile $dotgit]} { + set islink 1 + } else { + set objdir [file join $dotgit objects] + if {[file exists $objdir] && [file type $objdir] == {link}} { + set islink 1 + } + } + if {$islink} { + info_popup [mc "Hardlinks are unavailable. Falling back to copying."] + set clone_type full + } + } + } } if {$clone_type eq {hardlink} && ![file isdirectory $origin_url]} { @@ -599,14 +584,6 @@ method _do_clone2 {} { return } - if {$clone_type eq {hardlink} || $clone_type eq {shared}} { - set objdir [_objdir $origin_url] - if {$objdir eq {}} { - error_popup [mc "Not a Git repository: %s" [file tail $origin_url]] - return - } - } - set giturl $origin_url if {[file exists $local_path]} { @@ -614,459 +591,86 @@ method _do_clone2 {} { return } - if {![_git_init $this]} return - set local_path [pwd] - - if {[catch { - git config remote.$origin_name.url $giturl - git config remote.$origin_name.fetch +refs/heads/*:refs/remotes/$origin_name/* - } err]} { - error_popup [strcat [mc "Failed to configure origin"] "\n\n$err"] - return + set clone_options {--progress} + if {$recursive} { + append clone_options { --recurse-submodules} } destroy $w_body $w_next switch -exact -- $clone_type { - hardlink { - set o_status [status_bar::two_line $w_body] - pack $w_body -fill x -padx 10 -pady 10 - - set status_op [$o_status start \ - [mc "Counting objects"] \ - [mc "buckets"]] - update - - if {[file exists [file join $objdir info alternates]]} { - set pwd [pwd] - if {[catch { - file mkdir [gitdir objects info] - set f_in [safe_open_file [file join $objdir info alternates] r] - set f_cp [safe_open_file [gitdir objects info alternates] w] - fconfigure $f_in -translation binary -encoding binary - fconfigure $f_cp -translation binary -encoding binary - cd $objdir - while {[gets $f_in line] >= 0} { - puts $f_cp [file normalize $line] - } - close $f_in - close $f_cp - cd $pwd - } err]} { - catch {cd $pwd} - _clone_failed $this [mc "Unable to copy objects/info/alternates: %s" $err] - $status_op stop - return - } + full { + append clone_options { --no-hardlinks --no-local} } - - set tolink [list] - set buckets [glob \ - -tails \ - -nocomplain \ - -directory [file join $objdir] ??] - set bcnt [expr {[llength $buckets] + 2}] - set bcur 1 - $status_op update $bcur $bcnt - update - - file mkdir [file join .git objects pack] - foreach i [glob -tails -nocomplain \ - -directory [file join $objdir pack] *] { - lappend tolink [file join pack $i] - } - $status_op update [incr bcur] $bcnt - update - - foreach i $buckets { - file mkdir [file join .git objects $i] - foreach j [glob -tails -nocomplain \ - -directory [file join $objdir $i] *] { - lappend tolink [file join $i $j] - } - $status_op update [incr bcur] $bcnt - update - } - $status_op stop - - if {$tolink eq {}} { - info_popup [strcat \ - [mc "Nothing to clone from %s." $origin_url] \ - "\n" \ - [mc "The 'master' branch has not been initialized."] \ - ] - destroy $w_body - set done 1 - return - } - - set i [lindex $tolink 0] - if {[catch { - file link -hard \ - [file join .git objects $i] \ - [file join $objdir $i] - } err]} { - info_popup [mc "Hardlinks are unavailable. Falling back to copying."] - set i [_copy_files $this $objdir $tolink] - } else { - set i [_link_files $this $objdir [lrange $tolink 1 end]] + shared { + append clone_options { --shared} } - if {!$i} return - - destroy $w_body - - set o_status {} } - full { + + if {[catch { set o_cons [console::embed \ $w_body \ [mc "Cloning from %s" $origin_url]] pack $w_body -fill both -expand 1 -padx 10 $o_cons exec \ - [list git fetch --no-tags -k $origin_name] \ - [cb _do_clone_tags] - } - shared { - set fd [safe_open_file [gitdir objects info alternates] w] - fconfigure $fd -translation binary - puts $fd $objdir - close $fd - } - } - - if {$clone_type eq {hardlink} || $clone_type eq {shared}} { - if {![_clone_refs $this]} return - set pwd [pwd] - if {[catch { - cd $origin_url - set HEAD [git rev-parse --verify HEAD^0] - } err]} { - _clone_failed $this [mc "Not a Git repository: %s" [file tail $origin_url]] - return 0 - } - cd $pwd - _do_clone_checkout $this $HEAD - } -} - -method _copy_files {objdir tocopy} { - set status_op [$o_status start \ - [mc "Copying objects"] \ - [mc "KiB"]] - set tot 0 - set cmp 0 - foreach p $tocopy { - incr tot [file size [file join $objdir $p]] - } - foreach p $tocopy { - if {[catch { - set f_in [safe_open_file [file join $objdir $p] r] - set f_cp [safe_open_file [file join .git objects $p] w] - fconfigure $f_in -translation binary -encoding binary - fconfigure $f_cp -translation binary -encoding binary - - while {![eof $f_in]} { - incr cmp [fcopy $f_in $f_cp -size 16384] - $status_op update \ - [expr {$cmp / 1024}] \ - [expr {$tot / 1024}] - update - } - - close $f_in - close $f_cp - } err]} { - _clone_failed $this [mc "Unable to copy object: %s" $err] - $status_op stop - return 0 - } - } - $status_op stop - return 1 -} - -method _link_files {objdir tolink} { - set total [llength $tolink] - set status_op [$o_status start \ - [mc "Linking objects"] \ - [mc "objects"]] - for {set i 0} {$i < $total} {} { - set p [lindex $tolink $i] - if {[catch { - file link -hard \ - [file join .git objects $p] \ - [file join $objdir $p] - } err]} { - _clone_failed $this [mc "Unable to hardlink object: %s" $err] - $status_op stop - return 0 - } - - incr i - if {$i % 5 == 0} { - $status_op update $i $total - update - } - } - $status_op stop - return 1 -} - -method _clone_refs {} { - set pwd [pwd] - if {[catch {cd $origin_url} err]} { - error_popup [mc "Not a Git repository: %s" [file tail $origin_url]] - return 0 - } - set fd_in [git_read [list for-each-ref \ - --tcl \ - {--format=list %(refname) %(objectname) %(*objectname)}]] - cd $pwd - - set fd [safe_open_file [gitdir packed-refs] w] - fconfigure $fd -translation binary - puts $fd "# pack-refs with: peeled" - while {[gets $fd_in line] >= 0} { - set line [eval $line] - set refn [lindex $line 0] - set robj [lindex $line 1] - set tobj [lindex $line 2] - - if {[regsub ^refs/heads/ $refn \ - "refs/remotes/$origin_name/" refn]} { - puts $fd "$robj $refn" - } elseif {[string match refs/tags/* $refn]} { - puts $fd "$robj $refn" - if {$tobj ne {}} { - puts $fd "^$tobj" - } - } - } - close $fd_in - close $fd - return 1 -} - -method _do_clone_tags {ok} { - if {$ok} { - $o_cons exec \ - [list git fetch --tags -k $origin_name] \ - [cb _do_clone_HEAD] - } else { - $o_cons done $ok - _clone_failed $this [mc "Cannot fetch branches and objects. See console output for details."] + [list git clone {*}$clone_options $origin_url $local_path] \ + [cb _do_clone2_done] + } err]} { + error_popup [strcat [mc "Clone failed."] "\n" $err] + return } -} -method _do_clone_HEAD {ok} { - if {$ok} { - $o_cons exec \ - [list git fetch $origin_name HEAD] \ - [cb _do_clone_full_end] - } else { - $o_cons done $ok - _clone_failed $this [mc "Cannot fetch tags. See console output for details."] + tkwait variable @done + if {!$clone_ok} { + error_popup [mc "Clone failed."] + return } } -method _do_clone_full_end {ok} { +method _do_clone2_done {ok} { $o_cons done $ok - if {$ok} { - destroy $w_body - - set HEAD {} - if {[file exists [gitdir FETCH_HEAD]]} { - set fd [safe_open_file [gitdir FETCH_HEAD] r] - while {[gets $fd line] >= 0} { - if {[regexp "^(.{40})\t\t" $line line HEAD]} { - break - } - } - close $fd - } - - catch {git pack-refs} - _do_clone_checkout $this $HEAD - } else { - _clone_failed $this [mc "Cannot determine HEAD. See console output for details."] - } -} - -method _clone_failed {{why {}}} { - if {[catch {file delete -force $local_path} err]} { - set why [strcat \ - $why \ - "\n\n" \ - [mc "Unable to cleanup %s" $local_path] \ - "\n\n" \ - $err] - } - if {$why ne {}} { - update - error_popup [strcat [mc "Clone failed."] "\n" $why] - } -} - -method _do_clone_checkout {HEAD} { - if {$HEAD eq {}} { - info_popup [strcat \ - [mc "No default branch obtained."] \ - "\n" \ - [mc "The 'master' branch has not been initialized."] \ - ] - set done 1 - return - } - if {[catch { - git update-ref HEAD $HEAD^0 + if {[catch { + cd $local_path + set ::_gitdir .git + set ::_prefix {} + _append_recentrepos [pwd] } err]} { - info_popup [strcat \ - [mc "Cannot resolve %s as a commit." $HEAD^0] \ - "\n $err" \ - "\n" \ - [mc "The 'master' branch has not been initialized."] \ - ] - set done 1 - return - } - - set status [status_bar::two_line $w_body] - pack $w_body -fill x -padx 10 -pady 10 - - # We start the status operation here. - # - # This function calls _readtree_wait as a callback. - # - # _readtree_wait in turn either calls _do_clone_submodules directly, - # or calls _postcheckout_wait as a callback which then calls - # _do_clone_submodules. - # - # _do_clone_submodules calls _do_validate_submodule_cloning. - # - # _do_validate_submodule_cloning stops the status operation. - # - # There are no other calls into this chain from other code. - - set o_status_op [$status start \ - [mc "Creating working directory"] \ - [mc "files"]] - - set readtree_err {} - set fd [git_read [list read-tree \ - -m \ - -u \ - -v \ - HEAD \ - HEAD \ - ] \ - [list 2>@1]] - fconfigure $fd -blocking 0 -translation binary - fileevent $fd readable [cb _readtree_wait $fd] -} - -method _readtree_wait {fd} { - set buf [read $fd] - $o_status_op update_meter $buf - append readtree_err $buf - - fconfigure $fd -blocking 1 - if {![eof $fd]} { - fconfigure $fd -blocking 0 - return - } - - if {[catch {close $fd}]} { - set err $readtree_err - regsub {^fatal: } $err {} err - error_popup [strcat \ - [mc "Initial file checkout failed."] \ - "\n\n$err"] - return - } - - # -- Run the post-checkout hook. - # - set fd_ph [githook_read post-checkout [string repeat 0 40] \ - [git rev-parse HEAD] 1] - if {$fd_ph ne {}} { - global pch_error - set pch_error {} - fconfigure $fd_ph -blocking 0 -translation binary -eofchar {} - fileevent $fd_ph readable [cb _postcheckout_wait $fd_ph] - } else { - _do_clone_submodules $this - } -} - -method _postcheckout_wait {fd_ph} { - global pch_error - - append pch_error [read $fd_ph] - fconfigure $fd_ph -blocking 1 - if {[eof $fd_ph]} { - if {[catch {close $fd_ph}]} { - hook_failed_popup post-checkout $pch_error 0 + set ok 0 } - unset pch_error - _do_clone_submodules $this - return } - fconfigure $fd_ph -blocking 0 -} - -method _do_clone_submodules {} { - if {$recursive eq {true}} { - $o_status_op stop - set o_status_op {} - - destroy $w_body - - set o_cons [console::embed \ - $w_body \ - [mc "Cloning submodules"]] - pack $w_body -fill both -expand 1 -padx 10 - $o_cons exec \ - [list git submodule update --init --recursive] \ - [cb _do_validate_submodule_cloning] - } else { - set done 1 + if {!$ok} { + set ::_gitdir {} + set ::_prefix {} } + set clone_ok $ok + set done 1 } -method _do_validate_submodule_cloning {ok} { - if {$ok} { - $o_cons done $ok - set done 1 - } else { - _clone_failed $this [mc "Cannot clone submodules."] - } -} ###################################################################### ## ## Open Existing Repository method _do_open {} { - global NS $w_next conf \ -state disabled \ -command [cb _do_open2] \ -text [mc "Open"] - ${NS}::frame $w_body - ${NS}::label $w_body.h \ + ttk::frame $w_body + ttk::label $w_body.h \ -font font_uibold -anchor center \ -text [mc "Open Existing Repository"] pack $w_body.h -side top -fill x -pady 10 pack $w_body -fill x -padx 10 - ${NS}::frame $w_body.where - ${NS}::label $w_body.where.l -text [mc "Repository:"] - ${NS}::entry $w_body.where.t \ + ttk::frame $w_body.where + ttk::label $w_body.where.l -text [mc "Repository:"] + ttk::entry $w_body.where.t \ -textvariable @local_path \ -width 50 - ${NS}::button $w_body.where.b \ + ttk::button $w_body.where.b \ -text [mc "Browse"] \ -command [cb _open_local_path] diff --git a/git-gui/lib/choose_rev.tcl b/git-gui/lib/choose_rev.tcl index 8ae7e8a5c4..7a9e3c83bb 100644 --- a/git-gui/lib/choose_rev.tcl +++ b/git-gui/lib/choose_rev.tcl @@ -32,7 +32,7 @@ proc new_unmerged {path {title {}}} { } constructor _new {path unmerged_only title} { - global current_branch is_detached use_ttk NS + global current_branch is_detached if {![info exists ::all_remotes]} { load_all_remotes @@ -41,65 +41,60 @@ constructor _new {path unmerged_only title} { set w $path if {$title ne {}} { - ${NS}::labelframe $w -text $title + ttk::labelframe $w -text $title } else { - ${NS}::frame $w + ttk::frame $w } bind $w <Destroy> [cb _delete %W] if {$is_detached} { - ${NS}::radiobutton $w.detachedhead_r \ + ttk::radiobutton $w.detachedhead_r \ -text [mc "This Detached Checkout"] \ -value HEAD \ -variable @revtype - if {!$use_ttk} {$w.detachedhead_r configure -anchor w} grid $w.detachedhead_r -sticky we -padx {0 5} -columnspan 2 } - ${NS}::radiobutton $w.expr_r \ + ttk::radiobutton $w.expr_r \ -text [mc "Revision Expression:"] \ -value expr \ -variable @revtype - ${NS}::entry $w.expr_t \ + ttk::entry $w.expr_t \ -width 50 \ -textvariable @c_expr \ -validate key \ -validatecommand [cb _validate %d %S] grid $w.expr_r $w.expr_t -sticky we -padx {0 5} - ${NS}::frame $w.types - ${NS}::radiobutton $w.types.head_r \ + ttk::frame $w.types + ttk::radiobutton $w.types.head_r \ -text [mc "Local Branch"] \ -value head \ -variable @revtype pack $w.types.head_r -side left - ${NS}::radiobutton $w.types.trck_r \ + ttk::radiobutton $w.types.trck_r \ -text [mc "Tracking Branch"] \ -value trck \ -variable @revtype pack $w.types.trck_r -side left - ${NS}::radiobutton $w.types.tag_r \ + ttk::radiobutton $w.types.tag_r \ -text [mc "Tag"] \ -value tag \ -variable @revtype pack $w.types.tag_r -side left set w_filter $w.types.filter - ${NS}::entry $w_filter \ + ttk::entry $w_filter \ -width 12 \ -textvariable @filter \ -validate key \ -validatecommand [cb _filter %P] pack $w_filter -side right - pack [${NS}::label $w.types.filter_icon \ + pack [ttk::label $w.types.filter_icon \ -image ::choose_rev::img_find \ ] -side right grid $w.types -sticky we -padx {0 5} -columnspan 2 - if {$use_ttk} { - ttk::frame $w.list -style SListbox.TFrame -padding 2 - } else { - frame $w.list - } + ttk::frame $w.list -style SListbox.TFrame -padding 2 set w_list $w.list.l listbox $w_list \ -font font_diff \ @@ -109,9 +104,7 @@ constructor _new {path unmerged_only title} { -exportselection false \ -xscrollcommand [cb _sb_set $w.list.sbx h] \ -yscrollcommand [cb _sb_set $w.list.sby v] - if {$use_ttk} { - $w_list configure -relief flat -highlightthickness 0 -borderwidth 0 - } + $w_list configure -relief flat -highlightthickness 0 -borderwidth 0 pack $w_list -fill both -expand 1 grid $w.list -sticky nswe -padx {20 5} -columnspan 2 bind $w_list <Any-Motion> [cb _show_tooltip @%x,%y] @@ -238,12 +231,10 @@ constructor _new {path unmerged_only title} { } method none {text} { - global NS use_ttk if {![winfo exists $w.none_r]} { - ${NS}::radiobutton $w.none_r \ + ttk::radiobutton $w.none_r \ -value none \ -variable @revtype - if {!$use_ttk} {$w.none_r configure -anchor w} grid $w.none_r -sticky we -padx {0 5} -columnspan 2 } $w.none_r configure -text $text @@ -429,7 +420,6 @@ method _delete {current} { } method _sb_set {sb orient first last} { - global NS set old_focus [focus -lastfor $w] if {$first == 0 && $last == 1} { @@ -445,10 +435,10 @@ method _sb_set {sb orient first last} { if {![winfo exists $sb]} { if {$orient eq {h}} { - ${NS}::scrollbar $sb -orient h -command [list $w_list xview] + ttk::scrollbar $sb -orient h -command [list $w_list xview] pack $sb -fill x -side bottom -before $w_list } else { - ${NS}::scrollbar $sb -orient v -command [list $w_list yview] + ttk::scrollbar $sb -orient v -command [list $w_list yview] pack $sb -fill y -side right -before $w_list } if {$old_focus ne {}} { diff --git a/git-gui/lib/class.tcl b/git-gui/lib/class.tcl index f08506f383..0b1e67103f 100644 --- a/git-gui/lib/class.tcl +++ b/git-gui/lib/class.tcl @@ -136,7 +136,6 @@ proc delete_this {{t {}}} { proc make_dialog {t w args} { upvar $t top $w pfx this this - global use_ttk uplevel [linsert $args 0 make_toplevel $t $w] catch {wm attributes $top -type dialog} pave_toplevel $pfx diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl index 60d66172a1..2fd57a51fb 100644 --- a/git-gui/lib/commit.tcl +++ b/git-gui/lib/commit.tcl @@ -214,12 +214,10 @@ You must stage at least 1 file before you can commit. global comment_string set cmt_rx [strcat {(^|\n)} [regsub -all {\W} $comment_string {\\&}] {[^\n]*}] regsub -all $cmt_rx $msg {\1} msg - # Strip leading empty lines - regsub {^\n*} $msg {} msg + # Strip leading and trailing empty lines (puts adds one \n) + set msg [string trim $msg \n] # Compress consecutive empty lines regsub -all {\n{3,}} $msg "\n\n" msg - # Strip trailing empty line - regsub {\n\n$} $msg "\n" msg if {$msg eq {}} { error_popup [mc "Please supply a commit message. @@ -348,6 +346,7 @@ proc commit_committree {fd_wt curHEAD msg_p} { global file_states selected_paths rescan_active global repo_config global env + global hashlength gets $fd_wt tree_id if {[catch {close $fd_wt} err]} { @@ -367,7 +366,7 @@ proc commit_committree {fd_wt curHEAD msg_p} { close $fd_ot if {[string equal -length 5 {tree } $old_tree] - && [string length $old_tree] == 45} { + && [string length $old_tree] == [expr {$hashlength + 5}]} { set old_tree [string range $old_tree 5 end] } else { error [mc "Commit %s appears to be corrupt" $PARENT] diff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl index a017cfeadd..267699408c 100644 --- a/git-gui/lib/console.tcl +++ b/git-gui/lib/console.tcl @@ -27,20 +27,20 @@ constructor embed {path title} { } method _init {} { - global M1B use_ttk NS + global M1B if {$is_toplevel} { make_dialog top w -autodelete 0 wm title $top "[appname] ([reponame]): $t_short" } else { - ${NS}::frame $w + ttk::frame $w } set console_cr 1.0 set w_t $w.m.t - ${NS}::frame $w.m - ${NS}::label $w.m.l1 \ + ttk::frame $w.m + ttk::label $w.m.l1 \ -textvariable @t_long \ -anchor w \ -justify left \ @@ -78,7 +78,7 @@ method _init {} { " if {$is_toplevel} { - ${NS}::button $w.ok -text [mc "Close"] \ + ttk::button $w.ok -text [mc "Close"] \ -state disabled \ -command [list destroy $w] pack $w.ok -side bottom -anchor e -pady 10 -padx 10 @@ -207,14 +207,13 @@ method done {ok} { } method _sb_set {sb orient first last} { - global NS if {![winfo exists $sb]} { if {$first == $last || ($first == 0 && $last == 1)} return if {$orient eq {h}} { - ${NS}::scrollbar $sb -orient h -command [list $w_t xview] + ttk::scrollbar $sb -orient h -command [list $w_t xview] pack $sb -fill x -side bottom -before $w_t } else { - ${NS}::scrollbar $sb -orient v -command [list $w_t yview] + ttk::scrollbar $sb -orient v -command [list $w_t yview] pack $sb -fill y -side right -before $w_t } } diff --git a/git-gui/lib/database.tcl b/git-gui/lib/database.tcl index 1fc0ea00b3..78732d8651 100644 --- a/git-gui/lib/database.tcl +++ b/git-gui/lib/database.tcl @@ -2,7 +2,6 @@ # Copyright (C) 2006, 2007 Shawn Pearce proc do_stats {} { - global use_ttk NS set fd [git_read [list count-objects -v]] while {[gets $fd line] > 0} { if {[regexp {^([^:]+): (\d+)$} $line _ name value]} { @@ -26,18 +25,18 @@ proc do_stats {} { wm withdraw $w wm geometry $w "+[winfo rootx .]+[winfo rooty .]" - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.close -text [mc Close] \ + ttk::frame $w.buttons + ttk::button $w.buttons.close -text [mc Close] \ -default active \ -command [list destroy $w] - ${NS}::button $w.buttons.gc -text [mc "Compress Database"] \ + ttk::button $w.buttons.gc -text [mc "Compress Database"] \ -default normal \ -command "destroy $w;do_gc" pack $w.buttons.close -side right pack $w.buttons.gc -side left pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.stat -text [mc "Database Statistics"] + ttk::labelframe $w.stat -text [mc "Database Statistics"] foreach s { {count {mc "Number of loose objects"}} {size {mc "Disk space used by loose objects"} { KiB}} @@ -54,8 +53,8 @@ proc do_stats {} { set value "$value[lindex $s 2]" } - ${NS}::label $w.stat.l_$name -text [mc "%s:" $label] -anchor w - ${NS}::label $w.stat.v_$name -text $value -anchor w + ttk::label $w.stat.l_$name -text [mc "%s:" $label] -anchor w + ttk::label $w.stat.v_$name -text $value -anchor w grid $w.stat.l_$name $w.stat.v_$name -sticky we -padx {0 5} } pack $w.stat -pady 10 -padx 10 diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index 84f0468c7c..1acd37bdb4 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -2,15 +2,13 @@ # Copyright (C) 2006, 2007 Shawn Pearce proc apply_tab_size {{firsttab {}}} { - global have_tk85 repo_config ui_diff + global repo_config ui_diff set w [font measure font_diff "0"] - if {$have_tk85 && $firsttab != 0} { + if {$firsttab != 0} { $ui_diff configure -tabs [list [expr {$firsttab * $w}] [expr {($firsttab + $repo_config(gui.tabsize)) * $w}]] - } elseif {$have_tk85 || $repo_config(gui.tabsize) != 8} { - $ui_diff configure -tabs [expr {$repo_config(gui.tabsize) * $w}] } else { - $ui_diff configure -tabs {} + $ui_diff configure -tabs [expr {$repo_config(gui.tabsize) * $w}] } } @@ -280,9 +278,7 @@ proc start_show_diff {cont_info {add_opts {}}} { if {$w eq $ui_index} { lappend cmd diff-index lappend cmd --cached - if {[git-version >= "1.7.2"]} { - lappend cmd --ignore-submodules=dirty - } + lappend cmd --ignore-submodules=dirty } elseif {$w eq $ui_workdir} { if {[string first {U} $m] >= 0} { lappend cmd diff @@ -290,17 +286,14 @@ proc start_show_diff {cont_info {add_opts {}}} { lappend cmd diff-files } } - if {![is_config_false gui.textconv] && [git-version >= 1.6.1]} { + if {![is_config_false gui.textconv]} { lappend cmd --textconv } if {[string match {160000 *} [lindex $s 2]] || [string match {160000 *} [lindex $s 3]]} { set is_submodule_diff 1 - - if {[git-version >= "1.6.6"]} { - lappend cmd --submodule - } + lappend cmd --submodule } lappend cmd -p @@ -319,14 +312,6 @@ proc start_show_diff {cont_info {add_opts {}}} { lappend cmd $path } - if {$is_submodule_diff && [git-version < "1.6.6"]} { - if {$w eq $ui_index} { - set cmd [list submodule summary --cached -- $path] - } else { - set cmd [list submodule summary --files -- $path] - } - } - if {[catch {set fd [git_read_nice $cmd]} err]} { set diff_active 0 unlock_index diff --git a/git-gui/lib/error.tcl b/git-gui/lib/error.tcl index 8968a57f33..fc0b5ad5e0 100644 --- a/git-gui/lib/error.tcl +++ b/git-gui/lib/error.tcl @@ -71,13 +71,12 @@ proc ask_popup {msg} { } proc hook_failed_popup {hook msg {is_fatal 1}} { - global use_ttk NS set w .hookfail Dialog $w wm withdraw $w - ${NS}::frame $w.m - ${NS}::label $w.m.l1 -text [mc "%s hook failed:" $hook] \ + ttk::frame $w.m + ttk::label $w.m.l1 -text [mc "%s hook failed:" $hook] \ -anchor w \ -justify left \ -font font_uibold @@ -89,10 +88,10 @@ proc hook_failed_popup {hook msg {is_fatal 1}} { -width 80 -height 10 \ -font font_diff \ -yscrollcommand [list $w.m.sby set] - ${NS}::scrollbar $w.m.sby -command [list $w.m.t yview] + ttk::scrollbar $w.m.sby -command [list $w.m.t yview] pack $w.m.l1 -side top -fill x if {$is_fatal} { - ${NS}::label $w.m.l2 \ + ttk::label $w.m.l2 \ -text [mc "You must correct the above errors before committing."] \ -anchor w \ -justify left \ @@ -106,7 +105,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} { $w.m.t insert 1.0 $msg $w.m.t conf -state disabled - ${NS}::button $w.ok -text OK \ + ttk::button $w.ok -text OK \ -width 15 \ -command "destroy $w" pack $w.ok -side bottom -anchor e -pady 10 -padx 10 diff --git a/git-gui/lib/index.tcl b/git-gui/lib/index.tcl index 857864ff2b..377547034b 100644 --- a/git-gui/lib/index.tcl +++ b/git-gui/lib/index.tcl @@ -22,8 +22,6 @@ proc _close_updateindex {fd} { } proc rescan_on_error {err {after {}}} { - global use_ttk NS - set w .indexfried Dialog $w wm withdraw $w @@ -35,14 +33,14 @@ proc rescan_on_error {err {after {}}} { -borderwidth 0 -highlightthickness 0 \ -background [get_bg_color $w] $w.msg tag configure bold -font font_uibold -justify center - ${NS}::scrollbar $w.vs -command [list $w.msg yview] + ttk::scrollbar $w.vs -command [list $w.msg yview] $w.msg insert end $s bold \n\n$err {} $w.msg configure -state disabled - ${NS}::button $w.continue \ + ttk::button $w.continue \ -text [mc "Continue"] \ -command [list destroy $w] - ${NS}::button $w.unlock \ + ttk::button $w.unlock \ -text [mc "Unlock Index"] \ -command "destroy $w; _delete_indexlock" grid $w.msg - $w.vs -sticky news diff --git a/git-gui/lib/line.tcl b/git-gui/lib/line.tcl index a026de954c..5980ae805c 100644 --- a/git-gui/lib/line.tcl +++ b/git-gui/lib/line.tcl @@ -9,18 +9,17 @@ field ctext field linenum {} constructor new {i_w i_text args} { - global use_ttk NS set w $i_w set ctext $i_text - ${NS}::frame $w - ${NS}::label $w.l -text [mc "Goto Line:"] + ttk::frame $w + ttk::label $w.l -text [mc "Goto Line:"] tentry $w.ent \ -textvariable ${__this}::linenum \ -background lightgreen \ -validate key \ -validatecommand [cb _validate %P] - ${NS}::button $w.bn -text [mc Go] -command [cb _goto] + ttk::button $w.bn -text [mc Go] -command [cb _goto] pack $w.l -side left pack $w.bn -side right diff --git a/git-gui/lib/merge.tcl b/git-gui/lib/merge.tcl index 44c3f93584..3490beddae 100644 --- a/git-gui/lib/merge.tcl +++ b/git-gui/lib/merge.tcl @@ -112,16 +112,7 @@ method _start {} { close $fh set _last_merged_branch $branch - if {[git-version >= "2.5.0"]} { - set cmd [list git merge --strategy=recursive FETCH_HEAD] - } else { - set cmd [list git] - lappend cmd merge - lappend cmd --strategy=recursive - lappend cmd [git_redir [list fmt-merge-msg] [list <[gitdir FETCH_HEAD]]] - lappend cmd HEAD - lappend cmd $name - } + set cmd [list git merge --strategy=recursive FETCH_HEAD] ui_status [mc "Merging %s and %s..." $current_branch $stitle] set cons [console::new [mc "Merge"] "merge $stitle"] @@ -145,7 +136,7 @@ method _finish {cons ok} { constructor dialog {} { global current_branch - global M1B use_ttk NS + global M1B if {![_can_merge $this]} { delete_this @@ -160,21 +151,21 @@ constructor dialog {} { set _start [cb _start] - ${NS}::label $w.header \ + ttk::label $w.header \ -text [mc "Merge Into %s" $current_branch] \ -font font_uibold pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.visualize \ + ttk::frame $w.buttons + ttk::button $w.buttons.visualize \ -text [mc Visualize] \ -command [cb _visualize] pack $w.buttons.visualize -side left - ${NS}::button $w.buttons.merge \ + ttk::button $w.buttons.merge \ -text [mc Merge] \ -command $_start pack $w.buttons.merge -side right - ${NS}::button $w.buttons.cancel \ + ttk::button $w.buttons.cancel \ -text [mc "Cancel"] \ -command [cb _cancel] pack $w.buttons.cancel -side right -padx 5 diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl index e43971bfa3..487d70691d 100644 --- a/git-gui/lib/option.tcl +++ b/git-gui/lib/option.tcl @@ -91,7 +91,7 @@ proc save_config {} { proc do_options {} { global repo_config global_config font_descs global repo_config_new global_config_new - global ui_comm_spell use_ttk NS + global ui_comm_spell array unset repo_config_new array unset global_config_new @@ -115,23 +115,23 @@ proc do_options {} { wm transient $w [winfo parent $w] wm geometry $w "+[winfo rootx .]+[winfo rooty .]" - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.restore -text [mc "Restore Defaults"] \ + ttk::frame $w.buttons + ttk::button $w.buttons.restore -text [mc "Restore Defaults"] \ -default normal \ -command do_restore_defaults pack $w.buttons.restore -side left - ${NS}::button $w.buttons.save -text [mc Save] \ + ttk::button $w.buttons.save -text [mc Save] \ -default active \ -command [list do_save_config $w] pack $w.buttons.save -side right - ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \ + ttk::button $w.buttons.cancel -text [mc "Cancel"] \ -default normal \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.repo -text [mc "%s Repository" [reponame]] - ${NS}::labelframe $w.global -text [mc "Global (All Repositories)"] + ttk::labelframe $w.repo -text [mc "%s Repository" [reponame]] + ttk::labelframe $w.global -text [mc "Global (All Repositories)"] pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5 pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5 @@ -170,7 +170,7 @@ proc do_options {} { foreach f {repo global} { switch -glob -- $type { b { - ${NS}::checkbutton $w.$f.$optid -text $text \ + ttk::checkbutton $w.$f.$optid -text $text \ -variable ${f}_config_new($name) \ -onvalue true \ -offvalue false @@ -178,8 +178,8 @@ proc do_options {} { } i-* { regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max - ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] + ttk::frame $w.$f.$optid + ttk::label $w.$f.$optid.l -text [mc "%s:" $text] pack $w.$f.$optid.l -side left -anchor w -fill x tspinbox $w.$f.$optid.v \ -textvariable ${f}_config_new($name) \ @@ -193,9 +193,9 @@ proc do_options {} { } c - t { - ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] - ${NS}::entry $w.$f.$optid.v \ + ttk::frame $w.$f.$optid + ttk::label $w.$f.$optid.l -text [mc "%s:" $text] + ttk::entry $w.$f.$optid.v \ -width 20 \ -textvariable ${f}_config_new($name) pack $w.$f.$optid.l -side left -anchor w @@ -206,7 +206,7 @@ proc do_options {} { menu $w.$f.$optid.m build_encoding_menu $w.$f.$optid.m \ [list set ${f}_config_new($name)] 1 - ${NS}::button $w.$f.$optid.b \ + ttk::button $w.$f.$optid.b \ -text [mc "Change"] \ -command [list popup_btn_menu \ $w.$f.$optid.m $w.$f.$optid.b] @@ -216,17 +216,11 @@ proc do_options {} { } s { set opts [eval [lindex $option 3]] - ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] - if {$use_ttk} { - ttk::combobox $w.$f.$optid.v \ - -textvariable ${f}_config_new($name) \ - -values $opts -state readonly - } else { - eval tk_optionMenu $w.$f.$optid.v \ - ${f}_config_new($name) \ - $opts - } + ttk::frame $w.$f.$optid + ttk::label $w.$f.$optid.l -text [mc "%s:" $text] + ttk::combobox $w.$f.$optid.v \ + -textvariable ${f}_config_new($name) \ + -values $opts -state readonly pack $w.$f.$optid.l -side left -anchor w -fill x pack $w.$f.$optid.v -side right -anchor e -padx 5 pack $w.$f.$optid -side top -anchor w -fill x @@ -250,17 +244,11 @@ proc do_options {} { set ${f}_config_new(gui.spellingdictionary) $value } - ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text [mc "Spelling Dictionary:"] - if {$use_ttk} { - ttk::combobox $w.$f.$optid.v \ - -textvariable ${f}_config_new(gui.spellingdictionary) \ - -values $all_dicts -state readonly - } else { - eval tk_optionMenu $w.$f.$optid.v \ - ${f}_config_new(gui.spellingdictionary) \ - $all_dicts - } + ttk::frame $w.$f.$optid + ttk::label $w.$f.$optid.l -text [mc "Spelling Dictionary:"] + ttk::combobox $w.$f.$optid.v \ + -textvariable ${f}_config_new(gui.spellingdictionary) \ + -values $all_dicts -state readonly pack $w.$f.$optid.l -side left -anchor w -fill x pack $w.$f.$optid.v -side right -anchor e -padx 5 pack $w.$f.$optid -side top -anchor w -fill x @@ -278,9 +266,9 @@ proc do_options {} { set global_config_new(gui.$font^^size) \ [font configure $font -size] - ${NS}::frame $w.global.$name - ${NS}::label $w.global.$name.l -text [mc "%s:" $text] - ${NS}::button $w.global.$name.b \ + ttk::frame $w.global.$name + ttk::label $w.global.$name.l -text [mc "%s:" $text] + ttk::button $w.global.$name.b \ -text [mc "Change Font"] \ -command [list \ tchoosefont \ @@ -289,9 +277,9 @@ proc do_options {} { global_config_new(gui.$font^^family) \ global_config_new(gui.$font^^size) \ ] - ${NS}::label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) - ${NS}::label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) - ${NS}::label $w.global.$name.pt -text [mc "pt."] + ttk::label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) + ttk::label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) + ttk::label $w.global.$name.pt -text [mc "pt."] pack $w.global.$name.l -side left -anchor w pack $w.global.$name.b -side right -anchor e pack $w.global.$name.pt -side right -anchor w diff --git a/git-gui/lib/remote.tcl b/git-gui/lib/remote.tcl index cf796d1601..9b49b6e462 100644 --- a/git-gui/lib/remote.tcl +++ b/git-gui/lib/remote.tcl @@ -233,8 +233,6 @@ proc make_sure_remote_submenues_exist {remote_m} { proc update_all_remotes_menu_entry {} { global all_remotes - if {[git-version < 1.6.6]} { return } - set have_remote 0 foreach r $all_remotes { incr have_remote diff --git a/git-gui/lib/remote_add.tcl b/git-gui/lib/remote_add.tcl index 480a6b30d0..bff1376cb3 100644 --- a/git-gui/lib/remote_add.tcl +++ b/git-gui/lib/remote_add.tcl @@ -13,7 +13,7 @@ field location {}; # location of the remote the user has chosen field opt_action fetch; # action to do after registering the remote locally constructor dialog {} { - global repo_config use_ttk NS + global repo_config make_dialog top w wm withdraw $top @@ -22,34 +22,34 @@ constructor dialog {} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } - ${NS}::label $w.header -text [mc "Add New Remote"] \ + ttk::label $w.header -text [mc "Add New Remote"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.create -text [mc Add] \ + ttk::frame $w.buttons + ttk::button $w.buttons.create -text [mc Add] \ -default active \ -command [cb _add] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.desc -text [mc "Remote Details"] + ttk::labelframe $w.desc -text [mc "Remote Details"] - ${NS}::label $w.desc.name_l -text [mc "Name:"] + ttk::label $w.desc.name_l -text [mc "Name:"] set w_name $w.desc.name_t - ${NS}::entry $w_name \ + ttk::entry $w_name \ -width 40 \ -textvariable @name \ -validate key \ -validatecommand [cb _validate_name %d %S] grid $w.desc.name_l $w_name -sticky we -padx {0 5} - ${NS}::label $w.desc.loc_l -text [mc "Location:"] + ttk::label $w.desc.loc_l -text [mc "Location:"] set w_loc $w.desc.loc_t - ${NS}::entry $w_loc \ + ttk::entry $w_loc \ -width 40 \ -textvariable @location grid $w.desc.loc_l $w_loc -sticky we -padx {0 5} @@ -57,21 +57,21 @@ constructor dialog {} { grid columnconfigure $w.desc 1 -weight 1 pack $w.desc -anchor nw -fill x -pady 5 -padx 5 - ${NS}::labelframe $w.action -text [mc "Further Action"] + ttk::labelframe $w.action -text [mc "Further Action"] - ${NS}::radiobutton $w.action.fetch \ + ttk::radiobutton $w.action.fetch \ -text [mc "Fetch Immediately"] \ -value fetch \ -variable @opt_action pack $w.action.fetch -anchor nw - ${NS}::radiobutton $w.action.push \ + ttk::radiobutton $w.action.push \ -text [mc "Initialize Remote Repository and Push"] \ -value push \ -variable @opt_action pack $w.action.push -anchor nw - ${NS}::radiobutton $w.action.none \ + ttk::radiobutton $w.action.none \ -text [mc "Do Nothing Else Now"] \ -value none \ -variable @opt_action diff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl index c8c99b17a8..349d31edf3 100644 --- a/git-gui/lib/remote_branch_delete.tcl +++ b/git-gui/lib/remote_branch_delete.tcl @@ -23,7 +23,7 @@ field full_cache field cached constructor dialog {} { - global all_remotes M1B use_ttk NS + global all_remotes M1B make_dialog top w wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]] @@ -31,32 +31,28 @@ constructor dialog {} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } - ${NS}::label $w.header -text [mc "Delete Branch Remotely"] \ + ttk::label $w.header -text [mc "Delete Branch Remotely"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.delete -text [mc Delete] \ + ttk::frame $w.buttons + ttk::button $w.buttons.delete -text [mc Delete] \ -default active \ -command [cb _delete] pack $w.buttons.delete -side right - ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \ + ttk::button $w.buttons.cancel -text [mc "Cancel"] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.dest -text [mc "From Repository"] + ttk::labelframe $w.dest -text [mc "From Repository"] if {$all_remotes ne {}} { - ${NS}::radiobutton $w.dest.remote_r \ + ttk::radiobutton $w.dest.remote_r \ -text [mc "Remote:"] \ -value remote \ -variable @urltype - if {$use_ttk} { - ttk::combobox $w.dest.remote_m -textvariable @remote \ - -values $all_remotes -state readonly - } else { - eval tk_optionMenu $w.dest.remote_m @remote $all_remotes - } + ttk::combobox $w.dest.remote_m -textvariable @remote \ + -values $all_remotes -state readonly grid $w.dest.remote_r $w.dest.remote_m -sticky w if {[lsearch -sorted -exact $all_remotes origin] != -1} { set remote origin @@ -68,11 +64,11 @@ constructor dialog {} { } else { set urltype url } - ${NS}::radiobutton $w.dest.url_r \ + ttk::radiobutton $w.dest.url_r \ -text [mc "Arbitrary Location:"] \ -value url \ -variable @urltype - ${NS}::entry $w.dest.url_t \ + ttk::entry $w.dest.url_t \ -width 50 \ -textvariable @url \ -validate key \ @@ -85,19 +81,19 @@ constructor dialog {} { grid columnconfigure $w.dest 1 -weight 1 pack $w.dest -anchor nw -fill x -pady 5 -padx 5 - ${NS}::labelframe $w.heads -text [mc "Branches"] + ttk::labelframe $w.heads -text [mc "Branches"] slistbox $w.heads.l \ -height 10 \ -width 70 \ -listvariable @head_list \ -selectmode extended - ${NS}::frame $w.heads.footer - ${NS}::label $w.heads.footer.status \ + ttk::frame $w.heads.footer + ttk::label $w.heads.footer.status \ -textvariable @status \ -anchor w \ -justify left - ${NS}::button $w.heads.footer.rescan \ + ttk::button $w.heads.footer.rescan \ -text [mc "Rescan"] \ -command [cb _rescan] pack $w.heads.footer.status -side left -fill x @@ -107,8 +103,8 @@ constructor dialog {} { pack $w.heads.l -side left -fill both -expand 1 pack $w.heads -fill both -expand 1 -pady 5 -padx 5 - ${NS}::labelframe $w.validate -text [mc "Delete Only If"] - ${NS}::radiobutton $w.validate.head_r \ + ttk::labelframe $w.validate -text [mc "Delete Only If"] + ttk::radiobutton $w.validate.head_r \ -text [mc "Merged Into:"] \ -value head \ -variable @checktype @@ -116,7 +112,7 @@ constructor dialog {} { trace add variable @head_list write [cb _write_head_list] trace add variable @check_head write [cb _write_check_head] grid $w.validate.head_r $w.validate.head_m -sticky w - ${NS}::radiobutton $w.validate.always_r \ + ttk::radiobutton $w.validate.always_r \ -text [mc "Always (Do not perform merge checks)"] \ -value always \ -variable @checktype @@ -323,6 +319,8 @@ method _load {cache uri} { } method _read {cache fd} { + global hashlength + if {$fd ne $active_ls} { catch {close $fd} return @@ -330,7 +328,7 @@ method _read {cache fd} { while {[gets $fd line] >= 0} { if {[string match {*^{}} $line]} continue - if {[regexp {^([0-9a-f]{40}) (.*)$} $line _junk obj ref]} { + if {[regexp [string map "@@ $hashlength" {^([0-9a-f]{@@}) (.*)$}] $line _junk obj ref]} { if {[regsub ^refs/heads/ $ref {} abr]} { lappend head_list $abr lappend head_cache($cache) $abr diff --git a/git-gui/lib/search.tcl b/git-gui/lib/search.tcl index ef1e55521d..47a0d8c961 100644 --- a/git-gui/lib/search.tcl +++ b/git-gui/lib/search.tcl @@ -21,7 +21,6 @@ field smarktop field smarkbot constructor new {i_w i_text args} { - global use_ttk NS set w $i_w set ctext $i_text @@ -44,14 +43,14 @@ constructor new {i_w i_text args} { set history [list] - ${NS}::frame $w - ${NS}::label $w.l -text [mc Find:] + ttk::frame $w + ttk::label $w.l -text [mc Find:] tentry $w.ent -textvariable ${__this}::searchstring -background lightgreen - ${NS}::button $w.bn -text [mc Next] -command [cb find_next] - ${NS}::button $w.bp -text [mc Prev] -command [cb find_prev] - ${NS}::checkbutton $w.re -text [mc RegExp] \ + ttk::button $w.bn -text [mc Next] -command [cb find_next] + ttk::button $w.bp -text [mc Prev] -command [cb find_prev] + ttk::checkbutton $w.re -text [mc RegExp] \ -variable ${__this}::regexpsearch -command [cb _incrsearch] - ${NS}::checkbutton $w.cs -text [mc Case] \ + ttk::checkbutton $w.cs -text [mc Case] \ -variable ${__this}::casesensitive -command [cb _incrsearch] pack $w.l -side left pack $w.cs -side right diff --git a/git-gui/lib/sshkey.tcl b/git-gui/lib/sshkey.tcl index c3e681b899..7a6526d3db 100644 --- a/git-gui/lib/sshkey.tcl +++ b/git-gui/lib/sshkey.tcl @@ -18,7 +18,7 @@ proc find_ssh_key {} { } proc do_ssh_key {} { - global sshkey_title have_tk85 sshkey_fd use_ttk NS + global sshkey_title sshkey_fd set w .sshkey_dialog if {[winfo exists $w]} { @@ -38,9 +38,9 @@ proc do_ssh_key {} { set gen_state disabled } - ${NS}::frame $w.header - ${NS}::label $w.header.lbl -textvariable sshkey_title -anchor w - ${NS}::button $w.header.gen -text [mc "Generate Key"] \ + ttk::frame $w.header + ttk::label $w.header.lbl -textvariable sshkey_title -anchor w + ttk::button $w.header.gen -text [mc "Generate Key"] \ -command [list make_ssh_key $w] -state $gen_state pack $w.header.lbl -side left -expand 1 -fill x pack $w.header.gen -side right @@ -48,17 +48,14 @@ proc do_ssh_key {} { text $w.contents -width 60 -height 10 -wrap char -relief sunken pack $w.contents -fill both -expand 1 - if {$have_tk85} { - set clr darkblue - if {$use_ttk} { set clr [ttk::style lookup . -selectbackground] } - $w.contents configure -inactiveselectbackground $clr - } + set clr [ttk::style lookup . -selectbackground] + $w.contents configure -inactiveselectbackground $clr - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.close -text [mc Close] \ + ttk::frame $w.buttons + ttk::button $w.buttons.close -text [mc Close] \ -default active -command [list destroy $w] pack $w.buttons.close -side right - ${NS}::button $w.buttons.copy -text [mc "Copy To Clipboard"] \ + ttk::button $w.buttons.copy -text [mc "Copy To Clipboard"] \ -command [list tk_textCopy $w.contents] pack $w.buttons.copy -side left pack $w.buttons -side bottom -fill x -pady 5 -padx 5 diff --git a/git-gui/lib/status_bar.tcl b/git-gui/lib/status_bar.tcl index d32b14142f..f5c0204a2d 100644 --- a/git-gui/lib/status_bar.tcl +++ b/git-gui/lib/status_bar.tcl @@ -39,7 +39,6 @@ field operations ; # list of current ongoing operations field completed_operation_count constructor new {path} { - global use_ttk NS set w $path set w_l $w.l set w_c $w.c @@ -51,11 +50,8 @@ constructor new {path} { set operations [list] set completed_operation_count 0 - ${NS}::frame $w - if {!$use_ttk} { - $w configure -borderwidth 1 -relief sunken - } - ${NS}::label $w_l \ + ttk::frame $w + ttk::label $w_l \ -textvariable @status_bar_text \ -anchor w \ -justify left @@ -72,7 +68,6 @@ method _oneline_pack {} { } constructor two_line {path} { - global NS set w $path set w_l $w.l set w_c $w.c @@ -84,8 +79,8 @@ constructor two_line {path} { set operations [list] set completed_operation_count 0 - ${NS}::frame $w - ${NS}::label $w_l \ + ttk::frame $w + ttk::label $w_l \ -textvariable @status_bar_text \ -anchor w \ -justify left diff --git a/git-gui/lib/themed.tcl b/git-gui/lib/themed.tcl index f43d84e54f..8c4a0c2ee7 100644 --- a/git-gui/lib/themed.tcl +++ b/git-gui/lib/themed.tcl @@ -190,8 +190,7 @@ proc InitEntryFrame {} { } proc gold_frame {w args} { - global use_ttk - if {$use_ttk && ![is_MacOSX]} { + if {![is_MacOSX]} { eval [linsert $args 0 ttk::frame $w -style Gold.TFrame] } else { eval [linsert $args 0 frame $w -background gold] @@ -199,8 +198,7 @@ proc gold_frame {w args} { } proc tlabel {w args} { - global use_ttk - if {$use_ttk && ![is_MacOSX]} { + if {![is_MacOSX]} { set cmd [list ttk::label $w -style Color.TLabel] foreach {k v} $args { switch -glob -- $k { @@ -216,17 +214,7 @@ proc tlabel {w args} { # The padded label gets used in the about class. proc paddedlabel {w args} { - global use_ttk - if {$use_ttk} { - eval [linsert $args 0 ttk::label $w -style Padded.TLabel] - } else { - eval [linsert $args 0 label $w \ - -padx 5 -pady 5 \ - -justify left \ - -anchor w \ - -borderwidth 1 \ - -relief solid] - } + eval [linsert $args 0 ttk::label $w -style Padded.TLabel] } # Create a toplevel for use as a dialog. @@ -242,8 +230,7 @@ proc Dialog {w args} { # Tk toplevels are not themed - so pave it over with a themed frame to get # the base color correct per theme. proc pave_toplevel {w} { - global use_ttk - if {$use_ttk && ![winfo exists $w.!paving]} { + if {![winfo exists $w.!paving]} { set paving [ttk::frame $w.!paving] place $paving -x 0 -y 0 -relwidth 1 -relheight 1 lower $paving @@ -254,20 +241,11 @@ proc pave_toplevel {w} { # On many themes the border for a scrolled listbox needs to go around the # listbox and the scrollbar. proc slistbox {w args} { - global use_ttk NS - if {$use_ttk} { - set f [ttk::frame $w -style SListbox.TFrame -padding 2] - } else { - set f [frame $w -relief flat] - } + set f [ttk::frame $w -style SListbox.TFrame -padding 2] if {[catch { - if {$use_ttk} { - eval [linsert $args 0 listbox $f.list -relief flat \ - -highlightthickness 0 -borderwidth 0] - } else { - eval [linsert $args 0 listbox $f.list] - } - ${NS}::scrollbar $f.vs -command [list $f.list yview] + eval [linsert $args 0 listbox $f.list -relief flat \ + -highlightthickness 0 -borderwidth 0] + ttk::scrollbar $f.vs -command [list $f.list yview] $f.list configure -yscrollcommand [list $f.vs set] grid $f.list $f.vs -sticky news grid rowconfigure $f 0 -weight 1 @@ -285,67 +263,42 @@ proc slistbox {w args} { # fetch the background color from a widget. proc get_bg_color {w} { - global use_ttk - if {$use_ttk} { - set bg [ttk::style lookup [winfo class $w] -background] - } else { - set bg [$w cget -background] - } + set bg [ttk::style lookup [winfo class $w] -background] return $bg } -# ttk::spinbox didn't get added until 8.6 +# ttk::spinbox proc tspinbox {w args} { - global use_ttk - if {$use_ttk && [llength [info commands ttk::spinbox]] > 0} { - eval [linsert $args 0 ttk::spinbox $w] - } else { - eval [linsert $args 0 spinbox $w] - } + eval [linsert $args 0 ttk::spinbox $w] } # Create a text widget with any theme specific properties. proc ttext {w args} { - global use_ttk - if {$use_ttk} { - switch -- [ttk_get_current_theme] { - "vista" - "xpnative" { - lappend args -highlightthickness 0 -borderwidth 0 - } + switch -- [ttk_get_current_theme] { + "vista" - "xpnative" { + lappend args -highlightthickness 0 -borderwidth 0 } } set w [eval [linsert $args 0 text $w]] - if {$use_ttk} { - if {[winfo class [winfo parent $w]] eq "EntryFrame"} { - bind $w <FocusIn> {[winfo parent %W] state focus} - bind $w <FocusOut> {[winfo parent %W] state !focus} - } + if {[winfo class [winfo parent $w]] eq "EntryFrame"} { + bind $w <FocusIn> {[winfo parent %W] state focus} + bind $w <FocusOut> {[winfo parent %W] state !focus} } return $w } # themed frame suitable for surrounding a text field. proc textframe {w args} { - global use_ttk - if {$use_ttk} { - if {[catch {ttk::style layout EntryFrame}]} { - InitEntryFrame - } - eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame] - } else { - eval [linsert $args 0 frame $w] + if {[catch {ttk::style layout EntryFrame}]} { + InitEntryFrame } + eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame] return $w } proc tentry {w args} { - global use_ttk - if {$use_ttk} { - InitTheme - ttk::entry $w -style Edged.Entry - } else { - entry $w - } + InitTheme + ttk::entry $w -style Edged.Entry rename $w _$w interp alias {} $w {} tentry_widgetproc $w @@ -353,25 +306,14 @@ proc tentry {w args} { return $w } proc tentry_widgetproc {w cmd args} { - global use_ttk switch -- $cmd { state { - if {$use_ttk} { - return [uplevel 1 [list _$w $cmd] $args] - } else { - if {[lsearch -exact $args pressed] != -1} { - _$w configure -background lightpink - } else { - _$w configure -background lightgreen - } - } + return [uplevel 1 [list _$w $cmd] $args] } configure { - if {$use_ttk} { - if {[set n [lsearch -exact $args -background]] != -1} { - set args [lreplace $args $n [incr n]] - if {[llength $args] == 0} {return} - } + if {[set n [lsearch -exact $args -background]] != -1} { + set args [lreplace $args $n [incr n]] + if {[llength $args] == 0} {return} } return [uplevel 1 [list _$w $cmd] $args] } diff --git a/git-gui/lib/tools_dlg.tcl b/git-gui/lib/tools_dlg.tcl index c05413ce43..73236215b5 100644 --- a/git-gui/lib/tools_dlg.tcl +++ b/git-gui/lib/tools_dlg.tcl @@ -16,7 +16,7 @@ field ask_branch 0; # ask for a revision field ask_args 0; # ask for additional args constructor dialog {} { - global repo_config use_ttk NS + global repo_config make_dialog top w wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]] @@ -25,41 +25,41 @@ constructor dialog {} { wm transient $top . } - ${NS}::label $w.header -text [mc "Add New Tool Command"] \ + ttk::label $w.header -text [mc "Add New Tool Command"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::checkbutton $w.buttons.global \ + ttk::frame $w.buttons + ttk::checkbutton $w.buttons.global \ -text [mc "Add globally"] \ -variable @add_global pack $w.buttons.global -side left -padx 5 - ${NS}::button $w.buttons.create -text [mc Add] \ + ttk::button $w.buttons.create -text [mc Add] \ -default active \ -command [cb _add] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.desc -text [mc "Tool Details"] + ttk::labelframe $w.desc -text [mc "Tool Details"] - ${NS}::label $w.desc.name_cmnt -anchor w\ + ttk::label $w.desc.name_cmnt -anchor w\ -text [mc "Use '/' separators to create a submenu tree:"] grid x $w.desc.name_cmnt -sticky we -padx {0 5} -pady {0 2} - ${NS}::label $w.desc.name_l -text [mc "Name:"] + ttk::label $w.desc.name_l -text [mc "Name:"] set w_name $w.desc.name_t - ${NS}::entry $w_name \ + ttk::entry $w_name \ -width 40 \ -textvariable @name \ -validate key \ -validatecommand [cb _validate_name %d %S] grid $w.desc.name_l $w_name -sticky we -padx {0 5} - ${NS}::label $w.desc.cmd_l -text [mc "Command:"] + ttk::label $w.desc.cmd_l -text [mc "Command:"] set w_cmd $w.desc.cmd_t - ${NS}::entry $w_cmd \ + ttk::entry $w_cmd \ -width 40 \ -textvariable @command grid $w.desc.cmd_l $w_cmd -sticky we -padx {0 5} -pady {0 3} @@ -67,30 +67,30 @@ constructor dialog {} { grid columnconfigure $w.desc 1 -weight 1 pack $w.desc -anchor nw -fill x -pady 5 -padx 5 - ${NS}::checkbutton $w.confirm \ + ttk::checkbutton $w.confirm \ -text [mc "Show a dialog before running"] \ -variable @confirm -command [cb _check_enable_dlg] - ${NS}::labelframe $w.dlg -labelwidget $w.confirm + ttk::labelframe $w.dlg -labelwidget $w.confirm - ${NS}::checkbutton $w.dlg.askbranch \ + ttk::checkbutton $w.dlg.askbranch \ -text [mc "Ask the user to select a revision (sets \$REVISION)"] \ -variable @ask_branch -state disabled pack $w.dlg.askbranch -anchor w -padx 15 - ${NS}::checkbutton $w.dlg.askargs \ + ttk::checkbutton $w.dlg.askargs \ -text [mc "Ask the user for additional arguments (sets \$ARGS)"] \ -variable @ask_args -state disabled pack $w.dlg.askargs -anchor w -padx 15 pack $w.dlg -anchor nw -fill x -pady {0 8} -padx 5 - ${NS}::checkbutton $w.noconsole \ + ttk::checkbutton $w.noconsole \ -text [mc "Don't show the command output window"] \ -variable @no_console pack $w.noconsole -anchor w -padx 5 - ${NS}::checkbutton $w.needsfile \ + ttk::checkbutton $w.needsfile \ -text [mc "Run only if a diff is selected (\$FILENAME not empty)"] \ -variable @needs_file pack $w.needsfile -anchor w -padx 5 @@ -179,7 +179,7 @@ field w ; # widget path field w_names ; # name list constructor dialog {} { - global repo_config global_config system_config use_ttk NS + global repo_config global_config system_config load_config 1 @@ -190,21 +190,21 @@ constructor dialog {} { wm transient $top . } - ${NS}::label $w.header -text [mc "Remove Tool Commands"] \ + ttk::label $w.header -text [mc "Remove Tool Commands"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.create -text [mc Remove] \ + ttk::frame $w.buttons + ttk::button $w.buttons.create -text [mc Remove] \ -default active \ -command [cb _remove] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc Cancel] \ + ttk::button $w.buttons.cancel -text [mc Cancel] \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::frame $w.list + ttk::frame $w.list set w_names $w.list.l slistbox $w_names \ -height 10 \ @@ -227,7 +227,7 @@ constructor dialog {} { } if {$local_cnt > 0} { - ${NS}::label $w.colorlbl -foreground blue \ + ttk::label $w.colorlbl -foreground blue \ -text [mc "(Blue denotes repository-local tools)"] pack $w.colorlbl -fill x -pady 5 -padx 5 } @@ -272,7 +272,7 @@ field is_ok 0; # ok to start field argstr {}; # arguments constructor dialog {fullname} { - global M1B use_ttk NS + global M1B set title [get_config "guitool.$fullname.title"] if {$title eq {}} { @@ -292,7 +292,7 @@ constructor dialog {fullname} { set prompt [mc "Run Command: %s" $command] } - ${NS}::label $w.header -text $prompt -font font_uibold -anchor center + ttk::label $w.header -text $prompt -font font_uibold -anchor center pack $w.header -side top -fill x set argprompt [get_config "guitool.$fullname.argprompt"] @@ -306,10 +306,10 @@ constructor dialog {fullname} { set argprompt [mc "Arguments"] } - ${NS}::labelframe $w.arg -text $argprompt + ttk::labelframe $w.arg -text $argprompt set w_args $w.arg.txt - ${NS}::entry $w_args \ + ttk::entry $w_args \ -width 40 \ -textvariable @argstr pack $w_args -padx 5 -pady 5 -fill both @@ -330,18 +330,18 @@ constructor dialog {fullname} { pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5 } - ${NS}::frame $w.buttons + ttk::frame $w.buttons if {$is_ask_revs} { - ${NS}::button $w.buttons.visualize \ + ttk::button $w.buttons.visualize \ -text [mc Visualize] \ -command [cb _visualize] pack $w.buttons.visualize -side left } - ${NS}::button $w.buttons.ok \ + ttk::button $w.buttons.ok \ -text [mc OK] \ -command [cb _start] pack $w.buttons.ok -side right - ${NS}::button $w.buttons.cancel \ + ttk::button $w.buttons.cancel \ -text [mc "Cancel"] \ -command [cb _cancel] pack $w.buttons.cancel -side right -padx 5 diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl index a1a424aab5..020d09e112 100644 --- a/git-gui/lib/transport.tcl +++ b/git-gui/lib/transport.tcl @@ -120,7 +120,7 @@ trace add variable push_remote write \ proc do_push_anywhere {} { global all_remotes current_branch global push_urltype push_remote push_url push_thin push_tags - global push_force use_ttk NS + global push_force set w .push_setup toplevel $w @@ -129,22 +129,22 @@ proc do_push_anywhere {} { wm geometry $w "+[winfo rootx .]+[winfo rooty .]" pave_toplevel $w - ${NS}::label $w.header -text [mc "Push Branches"] \ + ttk::label $w.header -text [mc "Push Branches"] \ -font font_uibold -anchor center pack $w.header -side top -fill x - ${NS}::frame $w.buttons - ${NS}::button $w.buttons.create -text [mc Push] \ + ttk::frame $w.buttons + ttk::button $w.buttons.create -text [mc Push] \ -default active \ -command [list start_push_anywhere_action $w] pack $w.buttons.create -side right - ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \ + ttk::button $w.buttons.cancel -text [mc "Cancel"] \ -default normal \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - ${NS}::labelframe $w.source -text [mc "Source Branches"] + ttk::labelframe $w.source -text [mc "Source Branches"] slistbox $w.source.l \ -height 10 \ -width 70 \ @@ -159,20 +159,16 @@ proc do_push_anywhere {} { pack $w.source.l -side left -fill both -expand 1 pack $w.source -fill both -expand 1 -pady 5 -padx 5 - ${NS}::labelframe $w.dest -text [mc "Destination Repository"] + ttk::labelframe $w.dest -text [mc "Destination Repository"] if {$all_remotes ne {}} { - ${NS}::radiobutton $w.dest.remote_r \ + ttk::radiobutton $w.dest.remote_r \ -text [mc "Remote:"] \ -value remote \ -variable push_urltype - if {$use_ttk} { - ttk::combobox $w.dest.remote_m -state readonly \ - -exportselection false \ - -textvariable push_remote \ - -values $all_remotes - } else { - eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes - } + ttk::combobox $w.dest.remote_m -state readonly \ + -exportselection false \ + -textvariable push_remote \ + -values $all_remotes grid $w.dest.remote_r $w.dest.remote_m -sticky w if {[lsearch -sorted -exact $all_remotes origin] != -1} { set push_remote origin @@ -183,11 +179,11 @@ proc do_push_anywhere {} { } else { set push_urltype url } - ${NS}::radiobutton $w.dest.url_r \ + ttk::radiobutton $w.dest.url_r \ -text [mc "Arbitrary Location:"] \ -value url \ -variable push_urltype - ${NS}::entry $w.dest.url_t \ + ttk::entry $w.dest.url_t \ -width 50 \ -textvariable push_url \ -validate key \ @@ -202,16 +198,16 @@ proc do_push_anywhere {} { grid columnconfigure $w.dest 1 -weight 1 pack $w.dest -anchor nw -fill x -pady 5 -padx 5 - ${NS}::labelframe $w.options -text [mc "Transfer Options"] - ${NS}::checkbutton $w.options.force \ + ttk::labelframe $w.options -text [mc "Transfer Options"] + ttk::checkbutton $w.options.force \ -text [mc "Force overwrite existing branch (may discard changes)"] \ -variable push_force grid $w.options.force -columnspan 2 -sticky w - ${NS}::checkbutton $w.options.thin \ + ttk::checkbutton $w.options.thin \ -text [mc "Use thin pack (for slow network connections)"] \ -variable push_thin grid $w.options.thin -columnspan 2 -sticky w - ${NS}::checkbutton $w.options.tags \ + ttk::checkbutton $w.options.tags \ -text [mc "Include tags"] \ -variable push_tags grid $w.options.tags -columnspan 2 -sticky w diff --git a/git-gui/po/bg.po b/git-gui/po/bg.po index 27b05038e4..70ab2b438a 100644 --- a/git-gui/po/bg.po +++ b/git-gui/po/bg.po @@ -1,15 +1,15 @@ # Bulgarian translation of git-gui po-file. -# Copyright (C) 2012, 2013, 2014, 2015, 2016, 2024 Alexander Shopov <ash@kambanaria.org>. +# Copyright (C) 2012, 2013, 2014, 2015, 2016, 2024, 2025 Alexander Shopov <ash@kambanaria.org>. # This file is distributed under the same license as the git package. -# Alexander Shopov <ash@kambanaria.org>, 2012, 2013, 2014, 2015, 2016, 2024. +# Alexander Shopov <ash@kambanaria.org>, 2012, 2013, 2014, 2015, 2016, 2024, 2025. # # msgid "" msgstr "" "Project-Id-Version: git-gui master\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-08 22:54+0100\n" -"PO-Revision-Date: 2024-12-22 15:44+0100\n" +"POT-Creation-Date: 2025-04-20 09:27+0200\n" +"PO-Revision-Date: 2025-05-29 13:37+0200\n" "Last-Translator: Alexander Shopov <ash@kambanaria.org>\n" "Language-Team: Bulgarian <dict@fsa-bg.org>\n" "Language: bg\n" @@ -18,33 +18,33 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: git-gui.sh:847 +#: git-gui.sh:861 #, tcl-format msgid "Invalid font specified in %s:" msgstr "Указан е неправилен шрифт в „%s“:" -#: git-gui.sh:901 +#: git-gui.sh:924 msgid "Main Font" msgstr "Основен шрифт" -#: git-gui.sh:902 +#: git-gui.sh:925 msgid "Diff/Console Font" msgstr "Шрифт за разликите/конзолата" -#: git-gui.sh:917 git-gui.sh:931 git-gui.sh:944 git-gui.sh:1034 git-gui.sh:1053 -#: git-gui.sh:3212 +#: git-gui.sh:940 git-gui.sh:954 git-gui.sh:967 git-gui.sh:1057 git-gui.sh:1076 +#: git-gui.sh:3217 msgid "git-gui: fatal error" msgstr "git-gui: фатална грешка" -#: git-gui.sh:918 +#: git-gui.sh:941 msgid "Cannot find git in PATH." msgstr "Командата git липсва в пътя (PATH)." -#: git-gui.sh:945 +#: git-gui.sh:968 msgid "Cannot parse Git version string:" msgstr "Низът с версията на Git не може да се анализира:" -#: git-gui.sh:970 +#: git-gui.sh:993 #, tcl-format msgid "" "Git version cannot be determined.\n" @@ -63,23 +63,23 @@ msgstr "" "\n" "Да се приеме ли, че „%s“ е версия „1.5.0“?\n" -#: git-gui.sh:1267 +#: git-gui.sh:1287 msgid "Git directory not found:" msgstr "Директорията на Git не е открита:" -#: git-gui.sh:1301 +#: git-gui.sh:1317 msgid "Cannot move to top of working directory:" msgstr "Не може да се премине към родителската директория." -#: git-gui.sh:1309 +#: git-gui.sh:1325 msgid "Cannot use bare repository:" msgstr "Голо хранилище не може да се използва:" -#: git-gui.sh:1317 +#: git-gui.sh:1333 msgid "No working directory" msgstr "Работната директория липсва" -#: git-gui.sh:1491 lib/checkout_op.tcl:306 +#: git-gui.sh:1507 lib/checkout_op.tcl:306 msgid "Refreshing file status..." msgstr "Обновяване на състоянието на файла…" @@ -87,19 +87,19 @@ msgstr "Обновяване на състоянието на файла…" msgid "Scanning for modified files ..." msgstr "Проверка за променени файлове…" -#: git-gui.sh:1629 +#: git-gui.sh:1635 msgid "Calling prepare-commit-msg hook..." msgstr "Куката „prepare-commit-msg“ се изпълнява в момента…" -#: git-gui.sh:1646 +#: git-gui.sh:1652 msgid "Commit declined by prepare-commit-msg hook." msgstr "Подаването е отхвърлено от куката „prepare-commit-msg“." -#: git-gui.sh:1804 lib/browser.tcl:252 +#: git-gui.sh:1810 lib/browser.tcl:252 msgid "Ready." msgstr "Готово." -#: git-gui.sh:1968 +#: git-gui.sh:1974 #, tcl-format msgid "" "Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." @@ -108,664 +108,811 @@ msgstr "" "извеждане(gui.maxfilesdisplayed = %s), съответно не са показани всички %s " "файла." -#: git-gui.sh:2091 +#: git-gui.sh:2097 msgid "Unmodified" msgstr "Непроменен" -#: git-gui.sh:2093 +#: git-gui.sh:2099 msgid "Modified, not staged" msgstr "Променен, но не е в индекса" -#: git-gui.sh:2094 git-gui.sh:2106 +#: git-gui.sh:2100 git-gui.sh:2112 msgid "Staged for commit" msgstr "В индекса за подаване" -#: git-gui.sh:2095 git-gui.sh:2107 +#: git-gui.sh:2101 git-gui.sh:2113 msgid "Portions staged for commit" msgstr "Части са в индекса за подаване" -#: git-gui.sh:2096 git-gui.sh:2108 +#: git-gui.sh:2102 git-gui.sh:2114 msgid "Staged for commit, missing" msgstr "В индекса за подаване, но липсва" -#: git-gui.sh:2098 +#: git-gui.sh:2104 msgid "File type changed, not staged" msgstr "Видът на файла е сменен, но не е в индекса" -#: git-gui.sh:2099 git-gui.sh:2100 +#: git-gui.sh:2105 git-gui.sh:2106 msgid "File type changed, old type staged for commit" msgstr "Видът на файла е сменен, но новият вид не е в индекса" -#: git-gui.sh:2101 +#: git-gui.sh:2107 msgid "File type changed, staged" msgstr "Видът на файла е сменен и е в индекса" -#: git-gui.sh:2102 +#: git-gui.sh:2108 msgid "File type change staged, modification not staged" msgstr "Видът на файла е сменен в индекса, но не и съдържанието" -#: git-gui.sh:2103 +#: git-gui.sh:2109 msgid "File type change staged, file missing" msgstr "Видът на файла е сменен в индекса, но файлът липсва" -#: git-gui.sh:2105 +#: git-gui.sh:2111 msgid "Untracked, not staged" msgstr "Неследен" -#: git-gui.sh:2110 +#: git-gui.sh:2116 msgid "Missing" msgstr "Липсващ" -#: git-gui.sh:2111 +#: git-gui.sh:2117 msgid "Staged for removal" msgstr "В индекса за изтриване" -#: git-gui.sh:2112 +#: git-gui.sh:2118 msgid "Staged for removal, still present" msgstr "В индекса за изтриване, но още го има" -#: git-gui.sh:2114 git-gui.sh:2115 git-gui.sh:2116 git-gui.sh:2117 -#: git-gui.sh:2118 git-gui.sh:2119 +#: git-gui.sh:2120 git-gui.sh:2121 git-gui.sh:2122 git-gui.sh:2123 +#: git-gui.sh:2124 git-gui.sh:2125 msgid "Requires merge resolution" msgstr "Изисква коригиране при сливане" -#: git-gui.sh:2164 +#: git-gui.sh:2170 msgid "Couldn't find gitk in PATH" msgstr "Командата „gitk“ липсва в пътищата, определени от променливата PATH." -#: git-gui.sh:2210 git-gui.sh:2245 +#: git-gui.sh:2217 git-gui.sh:2253 #, tcl-format msgid "Starting %s... please wait..." msgstr "Стартиране на „%s“…, изчакайте…" -#: git-gui.sh:2224 +#: git-gui.sh:2232 msgid "Couldn't find git gui in PATH" msgstr "" "Командата „git gui“ липсва в пътищата, определени от променливата PATH." -#: git-gui.sh:2726 lib/choose_repository.tcl:53 +#: git-gui.sh:2735 lib/choose_repository.tcl:53 msgid "Repository" msgstr "Хранилище" -#: git-gui.sh:2727 +#: git-gui.sh:2736 msgid "Edit" msgstr "Редактиране" -#: git-gui.sh:2729 lib/choose_rev.tcl:567 +#: git-gui.sh:2738 lib/choose_rev.tcl:567 msgid "Branch" msgstr "Клон" -#: git-gui.sh:2732 lib/choose_rev.tcl:554 +#: git-gui.sh:2741 lib/choose_rev.tcl:554 msgid "Commit@@noun" msgstr "Подаване" -#: git-gui.sh:2735 lib/merge.tcl:127 lib/merge.tcl:174 +#: git-gui.sh:2744 lib/merge.tcl:127 lib/merge.tcl:174 msgid "Merge" msgstr "Сливане" -#: git-gui.sh:2736 lib/choose_rev.tcl:563 +#: git-gui.sh:2745 lib/choose_rev.tcl:563 msgid "Remote" msgstr "Отдалечено хранилище" -#: git-gui.sh:2739 +#: git-gui.sh:2748 msgid "Tools" msgstr "Команди" -#: git-gui.sh:2748 +#: git-gui.sh:2757 msgid "Explore Working Copy" msgstr "Разглеждане на работното копие" -#: git-gui.sh:2763 +#: git-gui.sh:2772 msgid "Git Bash" msgstr "Bash за Git" -#: git-gui.sh:2772 +#: git-gui.sh:2781 msgid "Browse Current Branch's Files" msgstr "Разглеждане на файловете в текущия клон" -#: git-gui.sh:2776 +#: git-gui.sh:2785 msgid "Browse Branch Files..." msgstr "Разглеждане на текущия клон…" -#: git-gui.sh:2781 +#: git-gui.sh:2790 msgid "Visualize Current Branch's History" msgstr "Визуализация на историята на текущия клон" -#: git-gui.sh:2785 +#: git-gui.sh:2794 msgid "Visualize All Branch History" msgstr "Визуализация на историята на всички клонове" -#: git-gui.sh:2792 +#: git-gui.sh:2801 #, tcl-format msgid "Browse %s's Files" msgstr "Разглеждане на файловете в „%s“" -#: git-gui.sh:2794 +#: git-gui.sh:2803 #, tcl-format msgid "Visualize %s's History" msgstr "Визуализация на историята на „%s“" -#: git-gui.sh:2799 lib/database.tcl:40 +#: git-gui.sh:2808 lib/database.tcl:40 msgid "Database Statistics" msgstr "Статистика на базата от данни" -#: git-gui.sh:2802 lib/database.tcl:33 +#: git-gui.sh:2811 lib/database.tcl:33 msgid "Compress Database" msgstr "Компресиране на базата от данни" -#: git-gui.sh:2805 +#: git-gui.sh:2814 msgid "Verify Database" msgstr "Проверка на базата от данни" -#: git-gui.sh:2812 git-gui.sh:2816 git-gui.sh:2820 +#: git-gui.sh:2821 git-gui.sh:2825 git-gui.sh:2829 msgid "Create Desktop Icon" msgstr "Добавяне на икона на работния плот" -#: git-gui.sh:2828 lib/choose_repository.tcl:209 lib/choose_repository.tcl:217 +#: git-gui.sh:2837 lib/choose_repository.tcl:206 lib/choose_repository.tcl:214 msgid "Quit" msgstr "Спиране на програмата" -#: git-gui.sh:2836 +#: git-gui.sh:2845 msgid "Undo" msgstr "Отмяна" -#: git-gui.sh:2839 +#: git-gui.sh:2848 msgid "Redo" msgstr "Повторение" -#: git-gui.sh:2843 git-gui.sh:3461 +#: git-gui.sh:2852 git-gui.sh:3477 msgid "Cut" msgstr "Отрязване" -#: git-gui.sh:2846 git-gui.sh:3464 git-gui.sh:3540 git-gui.sh:3633 +#: git-gui.sh:2855 git-gui.sh:3480 git-gui.sh:3556 git-gui.sh:3651 #: lib/console.tcl:69 msgid "Copy" msgstr "Копиране" -#: git-gui.sh:2849 git-gui.sh:3467 +#: git-gui.sh:2858 git-gui.sh:3483 msgid "Paste" msgstr "Поставяне" -#: git-gui.sh:2852 git-gui.sh:3470 lib/remote_branch_delete.tcl:39 -#: lib/branch_delete.tcl:28 +#: git-gui.sh:2861 git-gui.sh:3486 lib/branch_delete.tcl:28 +#: lib/remote_branch_delete.tcl:39 msgid "Delete" msgstr "Изтриване" -#: git-gui.sh:2856 git-gui.sh:3474 git-gui.sh:3637 lib/console.tcl:71 +#: git-gui.sh:2865 git-gui.sh:3490 git-gui.sh:3655 lib/console.tcl:71 msgid "Select All" msgstr "Избиране на всичко" -#: git-gui.sh:2865 +#: git-gui.sh:2874 msgid "Create..." msgstr "Създаване…" -#: git-gui.sh:2871 +#: git-gui.sh:2880 msgid "Checkout..." msgstr "Изтегляне…" -#: git-gui.sh:2877 +#: git-gui.sh:2886 msgid "Rename..." msgstr "Преименуване…" -#: git-gui.sh:2882 +#: git-gui.sh:2891 msgid "Delete..." msgstr "Изтриване…" -#: git-gui.sh:2887 +#: git-gui.sh:2896 msgid "Reset..." msgstr "Отмяна на промените…" -#: git-gui.sh:2897 +#: git-gui.sh:2906 msgid "Done" msgstr "Готово" -#: git-gui.sh:2899 +#: git-gui.sh:2908 msgid "Commit@@verb" msgstr "Подаване" -#: git-gui.sh:2908 git-gui.sh:3400 +#: git-gui.sh:2917 git-gui.sh:3416 msgid "Amend Last Commit" msgstr "Поправяне на последното подаване" -#: git-gui.sh:2918 git-gui.sh:3361 lib/remote_branch_delete.tcl:101 +#: git-gui.sh:2927 git-gui.sh:3377 lib/remote_branch_delete.tcl:101 msgid "Rescan" msgstr "Обновяване" -#: git-gui.sh:2924 +#: git-gui.sh:2933 msgid "Stage To Commit" msgstr "Към индекса за подаване" -#: git-gui.sh:2930 +#: git-gui.sh:2939 msgid "Stage Changed Files To Commit" msgstr "Всички променени файлове към индекса за подаване" -#: git-gui.sh:2936 +#: git-gui.sh:2945 msgid "Unstage From Commit" msgstr "Изваждане от индекса за подаване" -#: git-gui.sh:2942 lib/index.tcl:521 +#: git-gui.sh:2951 lib/index.tcl:521 msgid "Revert Changes" msgstr "Връщане на оригинала" -#: git-gui.sh:2950 git-gui.sh:3700 git-gui.sh:3731 +#: git-gui.sh:2959 git-gui.sh:3718 git-gui.sh:3749 msgid "Show Less Context" msgstr "По-малко контекст" -#: git-gui.sh:2954 git-gui.sh:3704 git-gui.sh:3735 +#: git-gui.sh:2963 git-gui.sh:3722 git-gui.sh:3753 msgid "Show More Context" msgstr "Повече контекст" -#: git-gui.sh:2961 git-gui.sh:3374 git-gui.sh:3485 +#: git-gui.sh:2970 git-gui.sh:3390 git-gui.sh:3501 msgid "Sign Off" msgstr "Подписване" -#: git-gui.sh:2977 +#: git-gui.sh:2986 msgid "Local Merge..." msgstr "Локално сливане…" -#: git-gui.sh:2982 +#: git-gui.sh:2991 msgid "Abort Merge..." msgstr "Преустановяване на сливане…" -#: git-gui.sh:2994 git-gui.sh:3022 +#: git-gui.sh:3003 git-gui.sh:3031 msgid "Add..." msgstr "Добавяне…" -#: git-gui.sh:2998 +#: git-gui.sh:3007 msgid "Push..." msgstr "Изтласкване…" -#: git-gui.sh:3002 +#: git-gui.sh:3011 msgid "Delete Branch..." msgstr "Изтриване на клон…" -#: git-gui.sh:3012 git-gui.sh:3666 +#: git-gui.sh:3021 git-gui.sh:3684 msgid "Options..." msgstr "Опции…" -#: git-gui.sh:3023 +#: git-gui.sh:3032 msgid "Remove..." msgstr "Премахване…" -#: git-gui.sh:3032 lib/choose_repository.tcl:67 +#: git-gui.sh:3041 lib/choose_repository.tcl:67 msgid "Help" msgstr "Помощ" -#: git-gui.sh:3036 git-gui.sh:3040 lib/choose_repository.tcl:61 -#: lib/choose_repository.tcl:70 lib/about.tcl:14 +#: git-gui.sh:3045 git-gui.sh:3049 lib/about.tcl:14 +#: lib/choose_repository.tcl:61 lib/choose_repository.tcl:70 #, tcl-format msgid "About %s" msgstr "Относно „%s“" -#: git-gui.sh:3064 +#: git-gui.sh:3069 msgid "Online Documentation" msgstr "Документация в Интернет" -#: git-gui.sh:3067 lib/choose_repository.tcl:64 lib/choose_repository.tcl:73 +#: git-gui.sh:3072 lib/choose_repository.tcl:64 lib/choose_repository.tcl:73 msgid "Show SSH Key" msgstr "Показване на ключа за SSH" -#: git-gui.sh:3097 git-gui.sh:3229 +#: git-gui.sh:3102 git-gui.sh:3234 msgid "usage:" msgstr "употреба:" -#: git-gui.sh:3101 git-gui.sh:3233 +#: git-gui.sh:3106 git-gui.sh:3238 msgid "Usage" msgstr "Употреба" -#: git-gui.sh:3182 lib/blame.tcl:575 +#: git-gui.sh:3187 lib/blame.tcl:576 msgid "Error" msgstr "Грешка" -#: git-gui.sh:3213 +#: git-gui.sh:3218 #, tcl-format msgid "fatal: cannot stat path %s: No such file or directory" msgstr "ФАТАЛНА ГРЕШКА: пътят „%s“ липсва: такъв файл или директория няма" -#: git-gui.sh:3246 +#: git-gui.sh:3251 msgid "Current Branch:" msgstr "Текущ клон:" -#: git-gui.sh:3271 +#: git-gui.sh:3276 msgid "Unstaged Changes" msgstr "Промени извън индекса" -#: git-gui.sh:3293 +#: git-gui.sh:3298 msgid "Staged Changes (Will Commit)" msgstr "Промени в индекса (за подаване)" -#: git-gui.sh:3367 +#: git-gui.sh:3383 msgid "Stage Changed" msgstr "Индексът е променен" -#: git-gui.sh:3386 lib/transport.tcl:137 +#: git-gui.sh:3402 lib/transport.tcl:137 msgid "Push" msgstr "Изтласкване" -#: git-gui.sh:3413 +#: git-gui.sh:3429 msgid "Initial Commit Message:" msgstr "Първоначално съобщение при подаване:" -#: git-gui.sh:3414 +#: git-gui.sh:3430 msgid "Amended Commit Message:" msgstr "Поправено съобщение при подаване:" -#: git-gui.sh:3415 +#: git-gui.sh:3431 msgid "Amended Initial Commit Message:" msgstr "Поправено първоначално съобщение при подаване:" -#: git-gui.sh:3416 +#: git-gui.sh:3432 msgid "Amended Merge Commit Message:" msgstr "Поправено съобщение при подаване със сливане:" -#: git-gui.sh:3417 +#: git-gui.sh:3433 msgid "Merge Commit Message:" msgstr "Съобщение при подаване със сливане:" -#: git-gui.sh:3418 +#: git-gui.sh:3434 msgid "Commit Message:" msgstr "Съобщение при подаване:" -#: git-gui.sh:3477 git-gui.sh:3641 lib/console.tcl:73 +#: git-gui.sh:3493 git-gui.sh:3659 lib/console.tcl:73 msgid "Copy All" msgstr "Копиране на всичко" -#: git-gui.sh:3501 lib/blame.tcl:106 +#: git-gui.sh:3517 lib/blame.tcl:106 msgid "File:" msgstr "Файл:" -#: git-gui.sh:3549 lib/choose_repository.tcl:1100 +#: git-gui.sh:3565 lib/choose_repository.tcl:1054 msgid "Open" msgstr "Отваряне" -#: git-gui.sh:3629 +#: git-gui.sh:3647 msgid "Refresh" msgstr "Обновяване" -#: git-gui.sh:3650 +#: git-gui.sh:3668 msgid "Decrease Font Size" msgstr "По-дребен шрифт" -#: git-gui.sh:3654 +#: git-gui.sh:3672 msgid "Increase Font Size" msgstr "По-едър шрифт" -#: git-gui.sh:3662 lib/blame.tcl:296 +#: git-gui.sh:3680 lib/blame.tcl:296 msgid "Encoding" msgstr "Кодиране" -#: git-gui.sh:3673 +#: git-gui.sh:3691 msgid "Apply/Reverse Hunk" msgstr "Прилагане/връщане на парче" -#: git-gui.sh:3678 +#: git-gui.sh:3696 msgid "Apply/Reverse Line" msgstr "Прилагане/връщане на ред" -#: git-gui.sh:3684 git-gui.sh:3794 git-gui.sh:3805 +#: git-gui.sh:3702 git-gui.sh:3812 git-gui.sh:3823 msgid "Revert Hunk" msgstr "Връщане на парче" -#: git-gui.sh:3689 git-gui.sh:3801 git-gui.sh:3812 +#: git-gui.sh:3707 git-gui.sh:3819 git-gui.sh:3830 msgid "Revert Line" msgstr "Връщане на ред" -#: git-gui.sh:3694 git-gui.sh:3791 +#: git-gui.sh:3712 git-gui.sh:3809 msgid "Undo Last Revert" msgstr "Отмяна на последното връщане" -#: git-gui.sh:3713 +#: git-gui.sh:3731 msgid "Run Merge Tool" msgstr "Изпълнение на програмата за сливане" -#: git-gui.sh:3718 +#: git-gui.sh:3736 msgid "Use Remote Version" msgstr "Версия от отдалеченото хранилище" -#: git-gui.sh:3722 +#: git-gui.sh:3740 msgid "Use Local Version" msgstr "Локална версия" -#: git-gui.sh:3726 +#: git-gui.sh:3744 msgid "Revert To Base" msgstr "Връщане към родителската версия" -#: git-gui.sh:3744 +#: git-gui.sh:3762 msgid "Visualize These Changes In The Submodule" msgstr "Визуализиране на промените в подмодула" -#: git-gui.sh:3748 +#: git-gui.sh:3766 msgid "Visualize Current Branch History In The Submodule" msgstr "Визуализация на историята на текущия клон в историята за подмодула" -#: git-gui.sh:3752 +#: git-gui.sh:3770 msgid "Visualize All Branch History In The Submodule" msgstr "Визуализация на историята на всички клони в историята за подмодула" -#: git-gui.sh:3757 +#: git-gui.sh:3775 msgid "Start git gui In The Submodule" msgstr "Стартиране на „git gui“ за подмодула" -#: git-gui.sh:3793 +#: git-gui.sh:3811 msgid "Unstage Hunk From Commit" msgstr "Изваждане на парчето от подаването" -#: git-gui.sh:3797 +#: git-gui.sh:3815 msgid "Unstage Lines From Commit" msgstr "Изваждане на редовете от подаването" -#: git-gui.sh:3798 git-gui.sh:3809 +#: git-gui.sh:3816 git-gui.sh:3827 msgid "Revert Lines" msgstr "Връщане на редовете" -#: git-gui.sh:3800 +#: git-gui.sh:3818 msgid "Unstage Line From Commit" msgstr "Изваждане на реда от подаването" -#: git-gui.sh:3804 +#: git-gui.sh:3822 msgid "Stage Hunk For Commit" msgstr "Добавяне на парчето за подаване" -#: git-gui.sh:3808 +#: git-gui.sh:3826 msgid "Stage Lines For Commit" msgstr "Добавяне на редовете за подаване" -#: git-gui.sh:3811 +#: git-gui.sh:3829 msgid "Stage Line For Commit" msgstr "Добавяне на реда за подаване" -#: git-gui.sh:3861 +#: git-gui.sh:3879 msgid "Initializing..." msgstr "Инициализиране…" -#: git-gui.sh:4017 +#: lib/about.tcl:26 +msgid "git-gui - a graphical user interface for Git." +msgstr "git-gui — графичен интерфейс за Git." + +#: lib/blame.tcl:74 #, tcl-format -msgid "" -"Possible environment issues exist.\n" -"\n" -"The following environment variables are probably\n" -"going to be ignored by any Git subprocess run\n" -"by %s:\n" -"\n" -msgstr "" -"Възможно е да има проблем със средата.\n" -"\n" -"Най-вероятно следните променливи няма да се\n" -"вземат под внимание от подпроцесите на Git\n" -"от %s:\n" -"\n" +msgid "%s (%s): File Viewer" +msgstr "%s (%s): Преглед на файлове" -#: git-gui.sh:4046 -msgid "" -"\n" -"This is due to a known issue with the\n" -"Tcl binary distributed by Cygwin." -msgstr "" -"\n" -"Това е познат проблем и се дължи на\n" -"версията на Tcl включена в Cygwin." +#: lib/blame.tcl:80 +msgid "Commit:" +msgstr "Подаване:" -#: git-gui.sh:4051 +#: lib/blame.tcl:282 +msgid "Copy Commit" +msgstr "Копиране на подаване" + +#: lib/blame.tcl:286 +msgid "Find Text..." +msgstr "Търсене на текст…" + +#: lib/blame.tcl:290 +msgid "Goto Line..." +msgstr "Към ред…" + +#: lib/blame.tcl:299 +msgid "Do Full Copy Detection" +msgstr "Пълно търсене на копиране" + +#: lib/blame.tcl:303 +msgid "Show History Context" +msgstr "Показване на контекста от историята" + +#: lib/blame.tcl:306 +msgid "Blame Parent Commit" +msgstr "Анотиране на родителското подаване" + +#: lib/blame.tcl:469 #, tcl-format -msgid "" -"\n" -"\n" -"A good replacement for %s\n" -"is placing values for the user.name and\n" -"user.email settings into your personal\n" -"~/.gitconfig file.\n" -msgstr "" -"\n" -"\n" -"Добър заместител на „%s“\n" -"е да поставите настройките „user.name“ и\n" -"„user.email“ в личния си файл „~/.gitconfig“.\n" +msgid "Reading %s..." +msgstr "Чете се „%s“…" -#: lib/spellcheck.tcl:57 -msgid "Unsupported spell checker" -msgstr "Тази програма за проверка на правописа не се поддържа" +#: lib/blame.tcl:597 +msgid "Loading copy/move tracking annotations..." +msgstr "Зареждане на анотациите за проследяване на копирането/преместването…" -#: lib/spellcheck.tcl:65 -msgid "Spell checking is unavailable" -msgstr "Липсва програма за проверка на правописа" +#: lib/blame.tcl:614 +msgid "lines annotated" +msgstr "реда анотирани" -#: lib/spellcheck.tcl:68 -msgid "Invalid spell checking configuration" -msgstr "Неправилни настройки на проверката на правописа" +#: lib/blame.tcl:816 +msgid "Loading original location annotations..." +msgstr "Зареждане на анотациите за първоначалното местоположение…" -#: lib/spellcheck.tcl:70 +#: lib/blame.tcl:819 +msgid "Annotation complete." +msgstr "Анотирането завърши." + +#: lib/blame.tcl:850 +msgid "Busy" +msgstr "Операцията не е завършила" + +#: lib/blame.tcl:851 +msgid "Annotation process is already running." +msgstr "В момента тече процес на анотиране." + +#: lib/blame.tcl:890 +msgid "Running thorough copy detection..." +msgstr "Изпълнява се цялостен процес на откриване на копиране…" + +#: lib/blame.tcl:958 +msgid "Loading annotation..." +msgstr "Зареждане на анотации…" + +#: lib/blame.tcl:1011 +msgid "Author:" +msgstr "Автор:" + +#: lib/blame.tcl:1015 +msgid "Committer:" +msgstr "Подал:" + +#: lib/blame.tcl:1020 +msgid "Original File:" +msgstr "Първоначален файл:" + +#: lib/blame.tcl:1068 +msgid "Cannot find HEAD commit:" +msgstr "Подаването за връх „HEAD“ не може да се открие:" + +#: lib/blame.tcl:1123 +msgid "Cannot find parent commit:" +msgstr "Родителското подаване не може да се открие" + +#: lib/blame.tcl:1138 +msgid "Unable to display parent" +msgstr "Родителят не може да се покаже" + +#: lib/blame.tcl:1139 lib/diff.tcl:334 +msgid "Error loading diff:" +msgstr "Грешка при зареждане на разлика:" + +#: lib/blame.tcl:1280 +msgid "Originally By:" +msgstr "Първоначално от:" + +#: lib/blame.tcl:1286 +msgid "In File:" +msgstr "Във файл:" + +#: lib/blame.tcl:1291 +msgid "Copied Or Moved Here By:" +msgstr "Копирано или преместено тук от:" + +#: lib/branch_checkout.tcl:16 #, tcl-format -msgid "Reverting dictionary to %s." -msgstr "Ползване на речник за език „%s“." +msgid "%s (%s): Checkout Branch" +msgstr "%s (%s): Клон за изтегляне" -#: lib/spellcheck.tcl:73 -msgid "Spell checker silently failed on startup" -msgstr "Програмата за правопис даже не стартира успешно." +#: lib/branch_checkout.tcl:21 +msgid "Checkout Branch" +msgstr "Клон за изтегляне" -#: lib/spellcheck.tcl:80 -msgid "Unrecognized spell checker" -msgstr "Непозната програма за проверка на правописа" +#: lib/branch_checkout.tcl:26 +msgid "Checkout" +msgstr "Изтегляне" -#: lib/spellcheck.tcl:186 -msgid "No Suggestions" -msgstr "Няма предложения" +#: lib/branch_checkout.tcl:30 lib/branch_create.tcl:37 lib/branch_delete.tcl:34 +#: lib/branch_rename.tcl:32 lib/browser.tcl:292 lib/checkout_op.tcl:580 +#: lib/choose_font.tcl:45 lib/merge.tcl:178 lib/option.tcl:127 +#: lib/remote_add.tcl:34 lib/remote_branch_delete.tcl:43 lib/tools_dlg.tcl:41 +#: lib/tools_dlg.tcl:202 lib/tools_dlg.tcl:345 lib/transport.tcl:141 +msgid "Cancel" +msgstr "Отказване" -#: lib/spellcheck.tcl:388 -msgid "Unexpected EOF from spell checker" -msgstr "Неочакван край на файл от програмата за проверка на правописа" +#: lib/branch_checkout.tcl:35 lib/browser.tcl:297 lib/tools_dlg.tcl:321 +msgid "Revision" +msgstr "Версия" -#: lib/spellcheck.tcl:392 -msgid "Spell Checker Failed" -msgstr "Грешка в програмата за проверка на правописа" +#: lib/branch_checkout.tcl:39 lib/branch_create.tcl:69 lib/option.tcl:310 +msgid "Options" +msgstr "Опции" + +#: lib/branch_checkout.tcl:42 lib/branch_create.tcl:92 +msgid "Fetch Tracking Branch" +msgstr "Изтегляне на промените от следения клон" + +#: lib/branch_checkout.tcl:47 +msgid "Detach From Local Branch" +msgstr "Изтриване от локалния клон" -#: lib/transport.tcl:6 lib/remote_add.tcl:132 +#: lib/branch_create.tcl:23 #, tcl-format -msgid "fetch %s" -msgstr "доставяне на „%s“" +msgid "%s (%s): Create Branch" +msgstr "%s (%s): Създаване на клон" -#: lib/transport.tcl:7 +#: lib/branch_create.tcl:28 +msgid "Create New Branch" +msgstr "Създаване на нов клон" + +#: lib/branch_create.tcl:33 lib/choose_repository.tcl:386 +msgid "Create" +msgstr "Създаване" + +#: lib/branch_create.tcl:42 +msgid "Branch Name" +msgstr "Име на клона" + +#: lib/branch_create.tcl:44 lib/remote_add.tcl:41 lib/tools_dlg.tcl:51 +msgid "Name:" +msgstr "Име:" + +#: lib/branch_create.tcl:57 +msgid "Match Tracking Branch Name" +msgstr "Съвпадане по името на следения клон" + +#: lib/branch_create.tcl:66 +msgid "Starting Revision" +msgstr "Начална версия" + +#: lib/branch_create.tcl:72 +msgid "Update Existing Branch:" +msgstr "Обновяване на съществуващ клон:" + +#: lib/branch_create.tcl:75 +msgid "No" +msgstr "Не" + +#: lib/branch_create.tcl:80 +msgid "Fast Forward Only" +msgstr "Само тривиално превъртащо сливане" + +#: lib/branch_create.tcl:85 lib/checkout_op.tcl:572 +msgid "Reset" +msgstr "Отначало" + +#: lib/branch_create.tcl:97 +msgid "Checkout After Creation" +msgstr "Преминаване към клона след създаването му" + +#: lib/branch_create.tcl:132 +msgid "Please select a tracking branch." +msgstr "Изберете клон за следени." + +#: lib/branch_create.tcl:141 #, tcl-format -msgid "Fetching new changes from %s" -msgstr "Доставяне на промените от „%s“" +msgid "Tracking branch %s is not a branch in the remote repository." +msgstr "Следящият клон — „%s“, не съществува в отдалеченото хранилище." -#: lib/transport.tcl:18 +#: lib/branch_create.tcl:154 lib/branch_rename.tcl:92 +msgid "Please supply a branch name." +msgstr "Дайте име на клона." + +#: lib/branch_create.tcl:165 lib/branch_rename.tcl:112 #, tcl-format -msgid "remote prune %s" -msgstr "окастряне на следящите клони към „%s“" +msgid "'%s' is not an acceptable branch name." +msgstr "„%s“ не може да се използва за име на клон." -#: lib/transport.tcl:19 +#: lib/branch_delete.tcl:16 #, tcl-format -msgid "Pruning tracking branches deleted from %s" -msgstr "Окастряне на следящите клони на изтритите клони от „%s“" +msgid "%s (%s): Delete Branch" +msgstr "%s (%s): Изтриване на клон" -#: lib/transport.tcl:25 -msgid "fetch all remotes" -msgstr "доставяне от всички отдалечени" +#: lib/branch_delete.tcl:21 +msgid "Delete Local Branch" +msgstr "Изтриване на локален клон" -#: lib/transport.tcl:26 -msgid "Fetching new changes from all remotes" -msgstr "Доставяне на промените от всички отдалечени хранилища" +#: lib/branch_delete.tcl:39 +msgid "Local Branches" +msgstr "Локални клони" -#: lib/transport.tcl:40 -msgid "remote prune all remotes" -msgstr "окастряне на следящите изтрити" +#: lib/branch_delete.tcl:51 +msgid "Delete Only If Merged Into" +msgstr "Изтриване, само ако промените са слети и другаде" -#: lib/transport.tcl:41 -msgid "Pruning tracking branches deleted from all remotes" -msgstr "" -"Окастряне на следящите клони на изтритите клони от всички отдалечени " -"хранилища" +#: lib/branch_delete.tcl:53 lib/remote_branch_delete.tcl:120 +msgid "Always (Do not perform merge checks)" +msgstr "Винаги (без проверка за сливане)" -#: lib/transport.tcl:54 lib/transport.tcl:92 lib/transport.tcl:110 -#: lib/remote_add.tcl:162 +#: lib/branch_delete.tcl:103 #, tcl-format -msgid "push %s" -msgstr "изтласкване на „%s“" +msgid "The following branches are not completely merged into %s:" +msgstr "Не всички промени в клоните са слети в „%s“:" -#: lib/transport.tcl:55 +#: lib/branch_delete.tcl:115 lib/remote_branch_delete.tcl:218 +msgid "" +"Recovering deleted branches is difficult.\n" +"\n" +"Delete the selected branches?" +msgstr "" +"Възстановяването на изтрити клони може да е трудно.\n" +"\n" +"Сигурни ли сте, че искате да триете?" + +#: lib/branch_delete.tcl:131 #, tcl-format -msgid "Pushing changes to %s" -msgstr "Изтласкване на промените към „%s“" +msgid " - %s:" +msgstr " — „%s:“" -#: lib/transport.tcl:93 +#: lib/branch_delete.tcl:141 #, tcl-format -msgid "Mirroring to %s" -msgstr "Изтласкване на всичко към „%s“" +msgid "" +"Failed to delete branches:\n" +"%s" +msgstr "" +"Неуспешно триене на клони:\n" +"%s" -#: lib/transport.tcl:111 +#: lib/branch_rename.tcl:15 #, tcl-format -msgid "Pushing %s %s to %s" -msgstr "Изтласкване на %s „%s“ към „%s“" +msgid "%s (%s): Rename Branch" +msgstr "%s (%s): Преименуване на клон" -#: lib/transport.tcl:132 -msgid "Push Branches" -msgstr "Клони за изтласкване" +#: lib/branch_rename.tcl:23 +msgid "Rename Branch" +msgstr "Преименуване на клон" -#: lib/transport.tcl:141 lib/checkout_op.tcl:580 lib/remote_add.tcl:34 -#: lib/browser.tcl:292 lib/branch_checkout.tcl:30 lib/branch_rename.tcl:32 -#: lib/choose_font.tcl:45 lib/option.tcl:127 lib/tools_dlg.tcl:41 -#: lib/tools_dlg.tcl:202 lib/tools_dlg.tcl:345 lib/remote_branch_delete.tcl:43 -#: lib/branch_create.tcl:37 lib/branch_delete.tcl:34 lib/merge.tcl:178 -msgid "Cancel" -msgstr "Отказване" +#: lib/branch_rename.tcl:28 +msgid "Rename" +msgstr "Преименуване" -#: lib/transport.tcl:147 -msgid "Source Branches" -msgstr "Клони-източници" +#: lib/branch_rename.tcl:38 +msgid "Branch:" +msgstr "Клон:" -#: lib/transport.tcl:162 -msgid "Destination Repository" -msgstr "Целево хранилище" +#: lib/branch_rename.tcl:46 +msgid "New Name:" +msgstr "Ново име:" -#: lib/transport.tcl:165 lib/remote_branch_delete.tcl:51 -msgid "Remote:" -msgstr "Отдалечено хранилище:" +#: lib/branch_rename.tcl:81 +msgid "Please select a branch to rename." +msgstr "Изберете клон за преименуване." -#: lib/transport.tcl:187 lib/remote_branch_delete.tcl:72 -msgid "Arbitrary Location:" -msgstr "Произволно местоположение:" +#: lib/branch_rename.tcl:102 lib/checkout_op.tcl:202 +#, tcl-format +msgid "Branch '%s' already exists." +msgstr "Клонът „%s“ вече съществува." -#: lib/transport.tcl:205 -msgid "Transfer Options" -msgstr "Настройки при пренасянето" +#: lib/branch_rename.tcl:123 +#, tcl-format +msgid "Failed to rename '%s'." +msgstr "Неуспешно преименуване на „%s“." -#: lib/transport.tcl:207 -msgid "Force overwrite existing branch (may discard changes)" -msgstr "" -"Изрично презаписване на съществуващ клон (някои промени може да се загубят)" +#: lib/browser.tcl:17 +msgid "Starting..." +msgstr "Стартиране…" -#: lib/transport.tcl:211 -msgid "Use thin pack (for slow network connections)" -msgstr "Максимална компресия (за бавни мрежови връзки)" +#: lib/browser.tcl:27 +#, tcl-format +msgid "%s (%s): File Browser" +msgstr "%s (%s): Файлов браузър" -#: lib/transport.tcl:215 -msgid "Include tags" -msgstr "Включване на етикетите" +#: lib/browser.tcl:132 lib/browser.tcl:149 +#, tcl-format +msgid "Loading %s..." +msgstr "Зареждане на „%s“…" -#: lib/transport.tcl:229 +#: lib/browser.tcl:193 +msgid "[Up To Parent]" +msgstr "[Към родителя]" + +#: lib/browser.tcl:275 #, tcl-format -msgid "%s (%s): Push" -msgstr "%s (%s): Изтласкване" +msgid "%s (%s): Browse Branch Files" +msgstr "%s (%s): Разглеждане на файловете в клона" + +#: lib/browser.tcl:282 +msgid "Browse Branch Files" +msgstr "Разглеждане на файловете в клона" + +#: lib/browser.tcl:288 lib/choose_repository.tcl:401 +#: lib/choose_repository.tcl:488 lib/choose_repository.tcl:497 +#: lib/choose_repository.tcl:1069 +msgid "Browse" +msgstr "Разглеждане" #: lib/checkout_op.tcl:85 #, tcl-format @@ -777,8 +924,8 @@ msgstr "Доставяне на „%s“ от „%s“" msgid "fatal: Cannot resolve %s" msgstr "фатална грешка: „%s“ не може да се открие" -#: lib/checkout_op.tcl:146 lib/sshkey.tcl:58 lib/console.tcl:81 -#: lib/database.tcl:30 +#: lib/checkout_op.tcl:146 lib/console.tcl:81 lib/database.tcl:30 +#: lib/sshkey.tcl:58 msgid "Close" msgstr "Затваряне" @@ -792,11 +939,6 @@ msgstr "Клонът „%s“ не съществува." msgid "Failed to configure simplified git-pull for '%s'." msgstr "Неуспешно настройване на опростен git-pull за „%s“." -#: lib/checkout_op.tcl:202 lib/branch_rename.tcl:102 -#, tcl-format -msgid "Branch '%s' already exists." -msgstr "Клонът „%s“ вече съществува." - #: lib/checkout_op.tcl:229 #, tcl-format msgid "" @@ -896,14 +1038,10 @@ msgstr "Възстановяването на загубените подава� msgid "Reset '%s'?" msgstr "Зануляване на „%s“?" -#: lib/checkout_op.tcl:568 lib/tools_dlg.tcl:336 lib/merge.tcl:170 +#: lib/checkout_op.tcl:568 lib/merge.tcl:170 lib/tools_dlg.tcl:336 msgid "Visualize" msgstr "Визуализация" -#: lib/checkout_op.tcl:572 lib/branch_create.tcl:85 -msgid "Reset" -msgstr "Отначало" - #: lib/checkout_op.tcl:636 #, tcl-format msgid "" @@ -922,327 +1060,6 @@ msgstr "" "Това състояние е аварийно и не трябва да се случва. Програмата „%s“ ще " "преустанови работа." -#: lib/remote_add.tcl:20 -#, tcl-format -msgid "%s (%s): Add Remote" -msgstr "%s (%s): Добавяне на отдалечено хранилище" - -#: lib/remote_add.tcl:25 -msgid "Add New Remote" -msgstr "Добавяне на отдалечено хранилище" - -#: lib/remote_add.tcl:30 lib/tools_dlg.tcl:37 -msgid "Add" -msgstr "Добавяне" - -#: lib/remote_add.tcl:39 -msgid "Remote Details" -msgstr "Данни за отдалеченото хранилище" - -#: lib/remote_add.tcl:41 lib/tools_dlg.tcl:51 lib/branch_create.tcl:44 -msgid "Name:" -msgstr "Име:" - -#: lib/remote_add.tcl:50 -msgid "Location:" -msgstr "Местоположение:" - -#: lib/remote_add.tcl:60 -msgid "Further Action" -msgstr "Следващо действие" - -#: lib/remote_add.tcl:63 -msgid "Fetch Immediately" -msgstr "Незабавно доставяне" - -#: lib/remote_add.tcl:69 -msgid "Initialize Remote Repository and Push" -msgstr "Инициализиране на отдалеченото хранилище и изтласкване на промените" - -#: lib/remote_add.tcl:75 -msgid "Do Nothing Else Now" -msgstr "Да не се прави нищо" - -#: lib/remote_add.tcl:100 -msgid "Please supply a remote name." -msgstr "Задайте име за отдалеченото хранилище." - -#: lib/remote_add.tcl:113 -#, tcl-format -msgid "'%s' is not an acceptable remote name." -msgstr "Отдалечено хранилище не може да се казва „%s“." - -#: lib/remote_add.tcl:124 -#, tcl-format -msgid "Failed to add remote '%s' of location '%s'." -msgstr "Неуспешно добавяне на отдалеченото хранилище „%s“ от адрес „%s“." - -#: lib/remote_add.tcl:133 -#, tcl-format -msgid "Fetching the %s" -msgstr "Доставяне на „%s“" - -#: lib/remote_add.tcl:156 -#, tcl-format -msgid "Do not know how to initialize repository at location '%s'." -msgstr "Хранилището с местоположение „%s“ не може да се инициализира." - -#: lib/remote_add.tcl:163 -#, tcl-format -msgid "Setting up the %s (at %s)" -msgstr "Добавяне на хранилище „%s“ (с адрес „%s“)" - -#: lib/browser.tcl:17 -msgid "Starting..." -msgstr "Стартиране…" - -#: lib/browser.tcl:27 -#, tcl-format -msgid "%s (%s): File Browser" -msgstr "%s (%s): Файлов браузър" - -#: lib/browser.tcl:132 lib/browser.tcl:149 -#, tcl-format -msgid "Loading %s..." -msgstr "Зареждане на „%s“…" - -#: lib/browser.tcl:193 -msgid "[Up To Parent]" -msgstr "[Към родителя]" - -#: lib/browser.tcl:275 -#, tcl-format -msgid "%s (%s): Browse Branch Files" -msgstr "%s (%s): Разглеждане на файловете в клона" - -#: lib/browser.tcl:282 -msgid "Browse Branch Files" -msgstr "Разглеждане на файловете в клона" - -#: lib/browser.tcl:288 lib/choose_repository.tcl:437 -#: lib/choose_repository.tcl:524 lib/choose_repository.tcl:533 -#: lib/choose_repository.tcl:1115 -msgid "Browse" -msgstr "Разглеждане" - -#: lib/browser.tcl:297 lib/branch_checkout.tcl:35 lib/tools_dlg.tcl:321 -msgid "Revision" -msgstr "Версия" - -#: lib/index.tcl:6 -msgid "Unable to unlock the index." -msgstr "Индексът не може да се отключи." - -#: lib/index.tcl:30 -msgid "Index Error" -msgstr "Грешка в индекса" - -#: lib/index.tcl:32 -msgid "" -"Updating the Git index failed. A rescan will be automatically started to " -"resynchronize git-gui." -msgstr "" -"Неуспешно обновяване на индекса на Git. Автоматично ще започне нова проверка " -"за синхронизирането на git-gui." - -#: lib/index.tcl:43 -msgid "Continue" -msgstr "Продължаване" - -#: lib/index.tcl:46 -msgid "Unlock Index" -msgstr "Отключване на индекса" - -#: lib/index.tcl:77 lib/index.tcl:146 lib/index.tcl:220 lib/index.tcl:587 -#: lib/choose_repository.tcl:999 -msgid "files" -msgstr "файлове" - -#: lib/index.tcl:326 -msgid "Unstaging selected files from commit" -msgstr "Изваждане на избраните файлове от подаването" - -#: lib/index.tcl:330 -#, tcl-format -msgid "Unstaging %s from commit" -msgstr "Изваждане на „%s“ от подаването" - -#: lib/index.tcl:369 -msgid "Ready to commit." -msgstr "Готовност за подаване." - -#: lib/index.tcl:378 -msgid "Adding selected files" -msgstr "Добавяне на избраните файлове" - -#: lib/index.tcl:382 -#, tcl-format -msgid "Adding %s" -msgstr "Добавяне на „%s“" - -#: lib/index.tcl:412 -#, tcl-format -msgid "Stage %d untracked files?" -msgstr "Да се добавят ли %d неследени файла към индекса?" - -#: lib/index.tcl:420 -msgid "Adding all changed files" -msgstr "Добавяне на всички променени файлове" - -#: lib/index.tcl:503 -#, tcl-format -msgid "Revert changes in file %s?" -msgstr "Да се махнат ли промените във файла „%s“?" - -#: lib/index.tcl:508 -#, tcl-format -msgid "Revert changes in these %i files?" -msgstr "Да се махнат ли промените в тези %i файла?" - -#: lib/index.tcl:517 -msgid "Any unstaged changes will be permanently lost by the revert." -msgstr "" -"Всички промени, които не са били добавени в индекса, ще се загубят " -"безвъзвратно." - -#: lib/index.tcl:520 lib/index.tcl:563 -msgid "Do Nothing" -msgstr "Нищо да не се прави" - -#: lib/index.tcl:545 -#, tcl-format -msgid "Delete untracked file %s?" -msgstr "Да се изтрие ли неследеният файл „%s“?" - -#: lib/index.tcl:550 -#, tcl-format -msgid "Delete these %i untracked files?" -msgstr "Да се изтрият ли тези %d неследени файла?" - -#: lib/index.tcl:560 -msgid "Files will be permanently deleted." -msgstr "Файловете ще се изтрият окончателно." - -#: lib/index.tcl:564 -msgid "Delete Files" -msgstr "Изтриване на файлове" - -#: lib/index.tcl:586 -msgid "Deleting" -msgstr "Изтриване" - -#: lib/index.tcl:665 -msgid "Encountered errors deleting files:\n" -msgstr "Грешки при изтриване на файловете:\n" - -#: lib/index.tcl:674 -#, tcl-format -msgid "None of the %d selected files could be deleted." -msgstr "Никой от избраните %d файла не бе изтрит." - -#: lib/index.tcl:679 -#, tcl-format -msgid "%d of the %d selected files could not be deleted." -msgstr "%d от избраните %d файла не бяха изтрити." - -#: lib/index.tcl:726 -msgid "Reverting selected files" -msgstr "Махане на промените в избраните файлове" - -#: lib/index.tcl:730 -#, tcl-format -msgid "Reverting %s" -msgstr "Махане на промените в „%s“" - -#: lib/branch_checkout.tcl:16 -#, tcl-format -msgid "%s (%s): Checkout Branch" -msgstr "%s (%s): Клон за изтегляне" - -#: lib/branch_checkout.tcl:21 -msgid "Checkout Branch" -msgstr "Клон за изтегляне" - -#: lib/branch_checkout.tcl:26 -msgid "Checkout" -msgstr "Изтегляне" - -#: lib/branch_checkout.tcl:39 lib/option.tcl:310 lib/branch_create.tcl:69 -msgid "Options" -msgstr "Опции" - -#: lib/branch_checkout.tcl:42 lib/branch_create.tcl:92 -msgid "Fetch Tracking Branch" -msgstr "Изтегляне на промените от следения клон" - -#: lib/branch_checkout.tcl:47 -msgid "Detach From Local Branch" -msgstr "Изтриване от локалния клон" - -#: lib/status_bar.tcl:263 -#, tcl-format -msgid "%s ... %*i of %*i %s (%3i%%)" -msgstr "%s… %*i от общо %*i %s (%3i%%)" - -#: lib/remote.tcl:200 -msgid "Push to" -msgstr "Изтласкване към" - -#: lib/remote.tcl:218 -msgid "Remove Remote" -msgstr "Премахване на отдалечено хранилище" - -#: lib/remote.tcl:223 -msgid "Prune from" -msgstr "Окастряне от" - -#: lib/remote.tcl:228 -msgid "Fetch from" -msgstr "Доставяне от" - -#: lib/remote.tcl:249 lib/remote.tcl:253 lib/remote.tcl:258 lib/remote.tcl:264 -msgid "All" -msgstr "Всички" - -#: lib/branch_rename.tcl:15 -#, tcl-format -msgid "%s (%s): Rename Branch" -msgstr "%s (%s): Преименуване на клон" - -#: lib/branch_rename.tcl:23 -msgid "Rename Branch" -msgstr "Преименуване на клон" - -#: lib/branch_rename.tcl:28 -msgid "Rename" -msgstr "Преименуване" - -#: lib/branch_rename.tcl:38 -msgid "Branch:" -msgstr "Клон:" - -#: lib/branch_rename.tcl:46 -msgid "New Name:" -msgstr "Ново име:" - -#: lib/branch_rename.tcl:81 -msgid "Please select a branch to rename." -msgstr "Изберете клон за преименуване." - -#: lib/branch_rename.tcl:92 lib/branch_create.tcl:154 -msgid "Please supply a branch name." -msgstr "Дайте име на клона." - -#: lib/branch_rename.tcl:112 lib/branch_create.tcl:165 -#, tcl-format -msgid "'%s' is not an acceptable branch name." -msgstr "„%s“ не може да се използва за име на клон." - -#: lib/branch_rename.tcl:123 -#, tcl-format -msgid "Failed to rename '%s'." -msgstr "Неуспешно преименуване на „%s“." - #: lib/choose_font.tcl:41 msgid "Select" msgstr "Избор" @@ -1267,518 +1084,11 @@ msgstr "" "Това е примерен текст.\n" "Ако ви харесва как изглежда, изберете шрифта." -#: lib/option.tcl:11 -#, tcl-format -msgid "Invalid global encoding '%s'" -msgstr "Неправилно глобално кодиране „%s“" - -#: lib/option.tcl:19 -#, tcl-format -msgid "Invalid repo encoding '%s'" -msgstr "Неправилно кодиране „%s“ на хранилището" - -#: lib/option.tcl:119 -msgid "Restore Defaults" -msgstr "Стандартни настройки" - -#: lib/option.tcl:123 -msgid "Save" -msgstr "Запазване" - -#: lib/option.tcl:133 -#, tcl-format -msgid "%s Repository" -msgstr "Хранилище „%s“" - -#: lib/option.tcl:134 -msgid "Global (All Repositories)" -msgstr "Глобално (за всички хранилища)" - -#: lib/option.tcl:140 -msgid "User Name" -msgstr "Потребителско име" - -#: lib/option.tcl:141 -msgid "Email Address" -msgstr "Адрес на е-поща" - -#: lib/option.tcl:143 -msgid "Summarize Merge Commits" -msgstr "Обобщаване на подаванията при сливане" - -#: lib/option.tcl:144 -msgid "Merge Verbosity" -msgstr "Подробности при сливанията" - -#: lib/option.tcl:145 -msgid "Show Diffstat After Merge" -msgstr "Извеждане на статистика след сливанията" - -#: lib/option.tcl:146 -msgid "Use Merge Tool" -msgstr "Използване на програма за сливане" - -#: lib/option.tcl:148 -msgid "Trust File Modification Timestamps" -msgstr "Доверие във времето на промяна на файловете" - -#: lib/option.tcl:149 -msgid "Prune Tracking Branches During Fetch" -msgstr "Окастряне на следящите клонове при доставяне" - -#: lib/option.tcl:150 -msgid "Match Tracking Branches" -msgstr "Напасване на следящите клонове" - -#: lib/option.tcl:151 -msgid "Use Textconv For Diffs and Blames" -msgstr "Използване на „textconv“ за разликите и анотирането" - -#: lib/option.tcl:152 -msgid "Blame Copy Only On Changed Files" -msgstr "Анотиране на копието само по променените файлове" - -#: lib/option.tcl:153 -msgid "Maximum Length of Recent Repositories List" -msgstr "Максимален брой на списъка „Скоро ползвани“ хранилища" - -#: lib/option.tcl:154 -msgid "Minimum Letters To Blame Copy On" -msgstr "Минимален брой знаци за анотиране на копието" - -#: lib/option.tcl:155 -msgid "Blame History Context Radius (days)" -msgstr "Исторически обхват за анотиране в дни" - -#: lib/option.tcl:156 -msgid "Number of Diff Context Lines" -msgstr "Брой редове за контекста на разликите" - -#: lib/option.tcl:157 -msgid "Additional Diff Parameters" -msgstr "Аргументи към командата за разликите" - -#: lib/option.tcl:158 -msgid "Commit Message Text Width" -msgstr "Широчина на текста на съобщението при подаване" - -#: lib/option.tcl:159 -msgid "New Branch Name Template" -msgstr "Шаблон за името на новите клони" - -#: lib/option.tcl:160 -msgid "Default File Contents Encoding" -msgstr "Кодиране на файловете" - -#: lib/option.tcl:161 -msgid "Warn before committing to a detached head" -msgstr "Предупреждаване при подаване към несвързан указател" - -#: lib/option.tcl:162 -msgid "Staging of untracked files" -msgstr "Добавяне на неследените файлове към индекса" - -#: lib/option.tcl:163 -msgid "Show untracked files" -msgstr "Показване на неследените файлове" - -#: lib/option.tcl:164 -msgid "Tab spacing" -msgstr "Ширина на табулацията" - -#: lib/option.tcl:182 lib/option.tcl:197 lib/option.tcl:220 lib/option.tcl:282 -#: lib/database.tcl:57 -#, tcl-format -msgid "%s:" -msgstr "%s:" - -#: lib/option.tcl:210 -msgid "Change" -msgstr "Смяна" - -#: lib/option.tcl:254 -msgid "Spelling Dictionary:" -msgstr "Правописен речник:" - -#: lib/option.tcl:284 -msgid "Change Font" -msgstr "Смяна на шрифта" - -#: lib/option.tcl:288 -#, tcl-format -msgid "Choose %s" -msgstr "Избор на „%s“" - -#: lib/option.tcl:294 -msgid "pt." -msgstr "тчк." - -#: lib/option.tcl:308 -msgid "Preferences" -msgstr "Настройки" - -#: lib/option.tcl:345 -msgid "Failed to completely save options:" -msgstr "Неуспешно запазване на настройките:" - -#: lib/encoding.tcl:443 -msgid "Default" -msgstr "Стандартното" - -#: lib/encoding.tcl:448 -#, tcl-format -msgid "System (%s)" -msgstr "Системното (%s)" - -#: lib/encoding.tcl:459 lib/encoding.tcl:465 -msgid "Other" -msgstr "Друго" - -#: lib/tools.tcl:76 -#, tcl-format -msgid "Running %s requires a selected file." -msgstr "За изпълнението на „%s“ трябва да изберете файл." - -#: lib/tools.tcl:92 -#, tcl-format -msgid "Are you sure you want to run %1$s on file \"%2$s\"?" -msgstr "Сигурни ли сте, че искате да изпълните „%1$s“ върху файла „%2$s“?" - -#: lib/tools.tcl:96 -#, tcl-format -msgid "Are you sure you want to run %s?" -msgstr "Сигурни ли сте, че искате да изпълните „%s“?" - -#: lib/tools.tcl:118 -#, tcl-format -msgid "Tool: %s" -msgstr "Команда: %s" - -#: lib/tools.tcl:119 -#, tcl-format -msgid "Running: %s" -msgstr "Изпълнение: %s" - -#: lib/tools.tcl:158 -#, tcl-format -msgid "Tool completed successfully: %s" -msgstr "Командата завърши успешно: %s" - -#: lib/tools.tcl:160 -#, tcl-format -msgid "Tool failed: %s" -msgstr "Командата върна грешка: %s" - -#: lib/mergetool.tcl:8 -msgid "Force resolution to the base version?" -msgstr "Да се използва базовата версия" - -#: lib/mergetool.tcl:9 -msgid "Force resolution to this branch?" -msgstr "Да се използва версията от този клон" - -#: lib/mergetool.tcl:10 -msgid "Force resolution to the other branch?" -msgstr "Да се използва версията от другия клон" - -#: lib/mergetool.tcl:14 -#, tcl-format -msgid "" -"Note that the diff shows only conflicting changes.\n" -"\n" -"%s will be overwritten.\n" -"\n" -"This operation can be undone only by restarting the merge." -msgstr "" -"Разликата показва само разликите с конфликт.\n" -"\n" -"Файлът „%s“ ще се презапише.\n" -"\n" -"Тази операция може да се отмени само чрез започване на сливането наново." - -#: lib/mergetool.tcl:45 -#, tcl-format -msgid "File %s seems to have unresolved conflicts, still stage?" -msgstr "" -"Изглежда, че все още има некоригирани конфликти във файла „%s“. Да се добави " -"ли файлът към индекса?" - -#: lib/mergetool.tcl:60 -#, tcl-format -msgid "Adding resolution for %s" -msgstr "Добавяне на корекция на конфликтите в „%s“" - -#: lib/mergetool.tcl:141 -msgid "Cannot resolve deletion or link conflicts using a tool" -msgstr "" -"Конфликтите при символни връзки или изтриване не може да се коригират с " -"външна програма." - -#: lib/mergetool.tcl:146 -msgid "Conflict file does not exist" -msgstr "Файлът, в който е конфликтът, не съществува" - -#: lib/mergetool.tcl:246 -#, tcl-format -msgid "Not a GUI merge tool: '%s'" -msgstr "Това не е графична програма за сливане: „%s“" - -#: lib/mergetool.tcl:275 -#, tcl-format -msgid "Unsupported merge tool '%s'" -msgstr "Неподдържана програма за сливане: „%s“" - -#: lib/mergetool.tcl:310 -msgid "Merge tool is already running, terminate it?" -msgstr "Програмата за сливане вече е стартирана. Да се изключи ли?" - -#: lib/mergetool.tcl:330 -#, tcl-format -msgid "" -"Error retrieving versions:\n" -"%s" -msgstr "" -"Грешка при изтеглянето на версии:\n" -"%s" - -#: lib/mergetool.tcl:350 -#, tcl-format -msgid "" -"Could not start the merge tool:\n" -"\n" -"%s" -msgstr "" -"Програмата за сливане не може да се стартира:\n" -"\n" -"%s" - -#: lib/mergetool.tcl:354 -msgid "Running merge tool..." -msgstr "Стартиране на програмата за сливане…" - -#: lib/mergetool.tcl:382 lib/mergetool.tcl:390 -msgid "Merge tool failed." -msgstr "Грешка в програмата за сливане." - -#: lib/tools_dlg.tcl:22 -#, tcl-format -msgid "%s (%s): Add Tool" -msgstr "%s (%s): Добавяне на команда" - -#: lib/tools_dlg.tcl:28 -msgid "Add New Tool Command" -msgstr "Добавяне на команда" - -#: lib/tools_dlg.tcl:34 -msgid "Add globally" -msgstr "Глобално добавяне" - -#: lib/tools_dlg.tcl:46 -msgid "Tool Details" -msgstr "Подробности за командата" - -#: lib/tools_dlg.tcl:49 -msgid "Use '/' separators to create a submenu tree:" -msgstr "За създаване на подменюта използвайте знака „/“ за разделител:" - -#: lib/tools_dlg.tcl:60 -msgid "Command:" -msgstr "Команда:" - -#: lib/tools_dlg.tcl:71 -msgid "Show a dialog before running" -msgstr "Преди изпълнение да се извежда диалогов прозорец" - -#: lib/tools_dlg.tcl:77 -msgid "Ask the user to select a revision (sets $REVISION)" -msgstr "Потребителят да укаже версия (задаване на променливата $REVISION)" - -#: lib/tools_dlg.tcl:82 -msgid "Ask the user for additional arguments (sets $ARGS)" -msgstr "" -"Потребителят да укаже допълнителни аргументи (задаване на променливата $ARGS)" - -#: lib/tools_dlg.tcl:89 -msgid "Don't show the command output window" -msgstr "Без показване на прозорец с изхода от командата" - -#: lib/tools_dlg.tcl:94 -msgid "Run only if a diff is selected ($FILENAME not empty)" -msgstr "" -"Стартиране само след избор на разлика (променливата $FILENAME не е празна)" - -#: lib/tools_dlg.tcl:118 -msgid "Please supply a name for the tool." -msgstr "Задайте име за командата." - -#: lib/tools_dlg.tcl:126 -#, tcl-format -msgid "Tool '%s' already exists." -msgstr "Командата „%s“ вече съществува." - -#: lib/tools_dlg.tcl:148 -#, tcl-format -msgid "" -"Could not add tool:\n" -"%s" -msgstr "" -"Командата не може да се добави:\n" -"%s" - -#: lib/tools_dlg.tcl:187 -#, tcl-format -msgid "%s (%s): Remove Tool" -msgstr "%s (%s): Премахване на команда" - -#: lib/tools_dlg.tcl:193 -msgid "Remove Tool Commands" -msgstr "Премахване на команди" - -#: lib/tools_dlg.tcl:198 -msgid "Remove" -msgstr "Премахване" - -#: lib/tools_dlg.tcl:231 -msgid "(Blue denotes repository-local tools)" -msgstr "(командите към локалното хранилище са обозначени в синьо)" - -#: lib/tools_dlg.tcl:283 -#, tcl-format -msgid "%s (%s):" -msgstr "%s (%s):" - -#: lib/tools_dlg.tcl:292 -#, tcl-format -msgid "Run Command: %s" -msgstr "Изпълнение на командата „%s“" - -#: lib/tools_dlg.tcl:306 -msgid "Arguments" -msgstr "Аргументи" - -#: lib/tools_dlg.tcl:341 -msgid "OK" -msgstr "Добре" - -#: lib/search.tcl:48 -msgid "Find:" -msgstr "Търсене:" - -#: lib/search.tcl:50 -msgid "Next" -msgstr "Следваща поява" - -#: lib/search.tcl:51 -msgid "Prev" -msgstr "Предишна поява" - -#: lib/search.tcl:52 -msgid "RegExp" -msgstr "РегИзр" - -#: lib/search.tcl:54 -msgid "Case" -msgstr "Главни/Малки" - -#: lib/shortcut.tcl:8 lib/shortcut.tcl:43 lib/shortcut.tcl:75 -#, tcl-format -msgid "%s (%s): Create Desktop Icon" -msgstr "%s (%s): Добавяне на икона на работния плот" - -#: lib/shortcut.tcl:24 lib/shortcut.tcl:65 -msgid "Cannot write shortcut:" -msgstr "Клавишната комбинация не може да се запази:" - -#: lib/shortcut.tcl:140 -msgid "Cannot write icon:" -msgstr "Иконата не може да се запази:" - -#: lib/remote_branch_delete.tcl:29 -#, tcl-format -msgid "%s (%s): Delete Branch Remotely" -msgstr "%s (%s): Изтриване на отдалечения клон" - -#: lib/remote_branch_delete.tcl:34 -msgid "Delete Branch Remotely" -msgstr "Изтриване на отдалечения клон" - -#: lib/remote_branch_delete.tcl:48 -msgid "From Repository" -msgstr "От хранилище" - -#: lib/remote_branch_delete.tcl:88 -msgid "Branches" -msgstr "Клони" - -#: lib/remote_branch_delete.tcl:110 -msgid "Delete Only If" -msgstr "Изтриване, само ако" - -#: lib/remote_branch_delete.tcl:112 -msgid "Merged Into:" -msgstr "Слят в:" - -#: lib/remote_branch_delete.tcl:120 lib/branch_delete.tcl:53 -msgid "Always (Do not perform merge checks)" -msgstr "Винаги (без проверка за сливане)" - -#: lib/remote_branch_delete.tcl:153 -msgid "A branch is required for 'Merged Into'." -msgstr "За данните „Слят в“ е необходимо да зададете клон." - -#: lib/remote_branch_delete.tcl:185 -#, tcl-format -msgid "" -"The following branches are not completely merged into %s:\n" -"\n" -" - %s" -msgstr "" -"Следните клони не са слети напълно в „%s“:\n" -"\n" -" ● %s" - -#: lib/remote_branch_delete.tcl:190 -#, tcl-format -msgid "" -"One or more of the merge tests failed because you have not fetched the " -"necessary commits. Try fetching from %s first." -msgstr "" -"Поне една от пробите за сливане е неуспешна, защото не сте доставили всички " -"необходими подавания. Пробвайте първо да доставите подаванията от „%s“." - -#: lib/remote_branch_delete.tcl:208 -msgid "Please select one or more branches to delete." -msgstr "Изберете поне един клон за изтриване." - -#: lib/remote_branch_delete.tcl:218 lib/branch_delete.tcl:115 -msgid "" -"Recovering deleted branches is difficult.\n" -"\n" -"Delete the selected branches?" -msgstr "" -"Възстановяването на изтрити клони може да е трудно.\n" -"\n" -"Сигурни ли сте, че искате да триете?" - -#: lib/remote_branch_delete.tcl:227 -#, tcl-format -msgid "Deleting branches from %s" -msgstr "Изтриване на клони от „%s“" - -#: lib/remote_branch_delete.tcl:300 -msgid "No repository selected." -msgstr "Не е избрано хранилище." - -#: lib/remote_branch_delete.tcl:305 -#, tcl-format -msgid "Scanning %s..." -msgstr "Претърсване на „%s“…" - #: lib/choose_repository.tcl:45 msgid "Git Gui" msgstr "ГПИ на Git" -#: lib/choose_repository.tcl:104 lib/choose_repository.tcl:427 +#: lib/choose_repository.tcl:104 lib/choose_repository.tcl:391 msgid "Create New Repository" msgstr "Създаване на ново хранилище" @@ -1786,7 +1096,7 @@ msgstr "Създаване на ново хранилище" msgid "New..." msgstr "Ново…" -#: lib/choose_repository.tcl:117 lib/choose_repository.tcl:511 +#: lib/choose_repository.tcl:117 lib/choose_repository.tcl:475 msgid "Clone Existing Repository" msgstr "Клониране на съществуващо хранилище" @@ -1794,7 +1104,7 @@ msgstr "Клониране на съществуващо хранилище" msgid "Clone..." msgstr "Клониране…" -#: lib/choose_repository.tcl:135 lib/choose_repository.tcl:1105 +#: lib/choose_repository.tcl:135 lib/choose_repository.tcl:1059 msgid "Open Existing Repository" msgstr "Отваряне на съществуващо хранилище" @@ -1810,556 +1120,211 @@ msgstr "Скоро ползвани" msgid "Open Recent Repository:" msgstr "Отваряне на хранилище ползвано наскоро:" -#: lib/choose_repository.tcl:331 lib/choose_repository.tcl:338 -#: lib/choose_repository.tcl:345 +#: lib/choose_repository.tcl:328 lib/choose_repository.tcl:335 +#: lib/choose_repository.tcl:342 #, tcl-format msgid "Failed to create repository %s:" msgstr "Неуспешно създаване на хранилището „%s“:" -#: lib/choose_repository.tcl:422 lib/branch_create.tcl:33 -msgid "Create" -msgstr "Създаване" - -#: lib/choose_repository.tcl:432 +#: lib/choose_repository.tcl:396 msgid "Directory:" msgstr "Директория:" -#: lib/choose_repository.tcl:462 lib/choose_repository.tcl:588 -#: lib/choose_repository.tcl:1139 +#: lib/choose_repository.tcl:426 lib/choose_repository.tcl:552 +#: lib/choose_repository.tcl:1093 msgid "Git Repository" msgstr "Хранилище на Git" -#: lib/choose_repository.tcl:487 +#: lib/choose_repository.tcl:451 #, tcl-format msgid "Directory %s already exists." msgstr "Вече съществува директория „%s“." -#: lib/choose_repository.tcl:491 +#: lib/choose_repository.tcl:455 #, tcl-format msgid "File %s already exists." msgstr "Вече съществува файл „%s“." -#: lib/choose_repository.tcl:506 +#: lib/choose_repository.tcl:470 msgid "Clone" msgstr "Клониране" -#: lib/choose_repository.tcl:519 +#: lib/choose_repository.tcl:483 msgid "Source Location:" msgstr "Адрес на източника:" -#: lib/choose_repository.tcl:528 +#: lib/choose_repository.tcl:492 msgid "Target Directory:" msgstr "Целева директория:" -#: lib/choose_repository.tcl:538 +#: lib/choose_repository.tcl:502 msgid "Clone Type:" msgstr "Вид клониране:" -#: lib/choose_repository.tcl:543 +#: lib/choose_repository.tcl:507 msgid "Standard (Fast, Semi-Redundant, Hardlinks)" msgstr "Стандартно (бързо, частично споделяне на файлове, твърди връзки)" -#: lib/choose_repository.tcl:548 +#: lib/choose_repository.tcl:512 msgid "Full Copy (Slower, Redundant Backup)" msgstr "Пълно (бавно, пълноценно резервно копие)" -#: lib/choose_repository.tcl:553 +#: lib/choose_repository.tcl:517 msgid "Shared (Fastest, Not Recommended, No Backup)" msgstr "Споделено (най-бързо, не се препоръчва, не прави резервно копие)" -#: lib/choose_repository.tcl:560 +#: lib/choose_repository.tcl:524 msgid "Recursively clone submodules too" msgstr "Рекурсивно клониране и на подмодулите" -#: lib/choose_repository.tcl:594 lib/choose_repository.tcl:641 -#: lib/choose_repository.tcl:790 lib/choose_repository.tcl:864 -#: lib/choose_repository.tcl:1145 lib/choose_repository.tcl:1153 +#: lib/choose_repository.tcl:558 lib/choose_repository.tcl:605 +#: lib/choose_repository.tcl:744 lib/choose_repository.tcl:818 +#: lib/choose_repository.tcl:1099 lib/choose_repository.tcl:1107 #, tcl-format msgid "Not a Git repository: %s" msgstr "Това не е хранилище на Git: %s" -#: lib/choose_repository.tcl:630 +#: lib/choose_repository.tcl:594 msgid "Standard only available for local repository." msgstr "Само локални хранилища може да се клонират стандартно" -#: lib/choose_repository.tcl:634 +#: lib/choose_repository.tcl:598 msgid "Shared only available for local repository." msgstr "Само локални хранилища може да се клонират споделено" -#: lib/choose_repository.tcl:655 +#: lib/choose_repository.tcl:613 #, tcl-format msgid "Location %s already exists." msgstr "Местоположението „%s“ вече съществува." -#: lib/choose_repository.tcl:666 +#: lib/choose_repository.tcl:624 msgid "Failed to configure origin" msgstr "Неуспешно настройване на хранилището-източник" -#: lib/choose_repository.tcl:678 +#: lib/choose_repository.tcl:636 msgid "Counting objects" msgstr "Преброяване на обекти" -#: lib/choose_repository.tcl:679 +#: lib/choose_repository.tcl:637 msgid "buckets" msgstr "клетки" -#: lib/choose_repository.tcl:703 +#: lib/choose_repository.tcl:657 #, tcl-format msgid "Unable to copy objects/info/alternates: %s" msgstr "Обектите/Информацията/Синонимите не може да се копират: %s" -#: lib/choose_repository.tcl:740 +#: lib/choose_repository.tcl:694 #, tcl-format msgid "Nothing to clone from %s." msgstr "Няма какво да се клонира от „%s“." -#: lib/choose_repository.tcl:742 lib/choose_repository.tcl:962 -#: lib/choose_repository.tcl:974 +#: lib/choose_repository.tcl:696 lib/choose_repository.tcl:916 +#: lib/choose_repository.tcl:928 msgid "The 'master' branch has not been initialized." msgstr "Основният клон — „master“ не е инициализиран." -#: lib/choose_repository.tcl:755 +#: lib/choose_repository.tcl:709 msgid "Hardlinks are unavailable. Falling back to copying." msgstr "Не се поддържат твърди връзки. Преминава се към копиране." -#: lib/choose_repository.tcl:769 +#: lib/choose_repository.tcl:723 #, tcl-format msgid "Cloning from %s" msgstr "Клониране на „%s“" -#: lib/choose_repository.tcl:800 +#: lib/choose_repository.tcl:754 msgid "Copying objects" msgstr "Копиране на обекти" -#: lib/choose_repository.tcl:801 +#: lib/choose_repository.tcl:755 msgid "KiB" msgstr "KiB" -#: lib/choose_repository.tcl:825 +#: lib/choose_repository.tcl:779 #, tcl-format msgid "Unable to copy object: %s" msgstr "Неуспешно копиране на обект: %s" -#: lib/choose_repository.tcl:837 +#: lib/choose_repository.tcl:791 msgid "Linking objects" msgstr "Създаване на връзки към обектите" -#: lib/choose_repository.tcl:838 +#: lib/choose_repository.tcl:792 msgid "objects" msgstr "обекти" -#: lib/choose_repository.tcl:846 +#: lib/choose_repository.tcl:800 #, tcl-format msgid "Unable to hardlink object: %s" msgstr "Неуспешно създаване на твърда връзка към обект: %s" -#: lib/choose_repository.tcl:903 +#: lib/choose_repository.tcl:857 msgid "Cannot fetch branches and objects. See console output for details." msgstr "" "Клоните и обектите не може да се изтеглят. За повече информация погледнете " "изхода на конзолата." -#: lib/choose_repository.tcl:914 +#: lib/choose_repository.tcl:868 msgid "Cannot fetch tags. See console output for details." msgstr "" "Етикетите не може да се изтеглят. За повече информация погледнете изхода на " "конзолата." -#: lib/choose_repository.tcl:938 +#: lib/choose_repository.tcl:892 msgid "Cannot determine HEAD. See console output for details." msgstr "" "Върхът „HEAD“ не може да се определи. За повече информация погледнете изхода " "на конзолата." -#: lib/choose_repository.tcl:947 +#: lib/choose_repository.tcl:901 #, tcl-format msgid "Unable to cleanup %s" msgstr "„%s“ не може да се изчисти" -#: lib/choose_repository.tcl:953 +#: lib/choose_repository.tcl:907 msgid "Clone failed." msgstr "Неуспешно клониране." -#: lib/choose_repository.tcl:960 +#: lib/choose_repository.tcl:914 msgid "No default branch obtained." msgstr "Не е получен клон по подразбиране." -#: lib/choose_repository.tcl:971 +#: lib/choose_repository.tcl:925 #, tcl-format msgid "Cannot resolve %s as a commit." msgstr "Няма подаване отговарящо на „%s“." -#: lib/choose_repository.tcl:998 +#: lib/choose_repository.tcl:952 msgid "Creating working directory" msgstr "Създаване на работната директория" -#: lib/choose_repository.tcl:1028 +#: lib/choose_repository.tcl:953 lib/index.tcl:77 lib/index.tcl:146 +#: lib/index.tcl:220 lib/index.tcl:589 +msgid "files" +msgstr "файлове" + +#: lib/choose_repository.tcl:982 msgid "Initial file checkout failed." msgstr "Неуспешно първоначално изтегляне." -#: lib/choose_repository.tcl:1072 +#: lib/choose_repository.tcl:1026 msgid "Cloning submodules" msgstr "Клониране на подмодули" -#: lib/choose_repository.tcl:1087 +#: lib/choose_repository.tcl:1041 msgid "Cannot clone submodules." msgstr "Подмодулите не може да се клонират." -#: lib/choose_repository.tcl:1110 +#: lib/choose_repository.tcl:1064 msgid "Repository:" msgstr "Хранилище:" -#: lib/choose_repository.tcl:1159 +#: lib/choose_repository.tcl:1113 #, tcl-format msgid "Failed to open repository %s:" msgstr "Неуспешно отваряне на хранилището „%s“:" -#: lib/about.tcl:26 -msgid "git-gui - a graphical user interface for Git." -msgstr "git-gui — графичен интерфейс за Git." - -#: lib/blame.tcl:74 -#, tcl-format -msgid "%s (%s): File Viewer" -msgstr "%s (%s): Преглед на файлове" - -#: lib/blame.tcl:80 -msgid "Commit:" -msgstr "Подаване:" - -#: lib/blame.tcl:282 -msgid "Copy Commit" -msgstr "Копиране на подаване" - -#: lib/blame.tcl:286 -msgid "Find Text..." -msgstr "Търсене на текст…" - -#: lib/blame.tcl:290 -msgid "Goto Line..." -msgstr "Към ред…" - -#: lib/blame.tcl:299 -msgid "Do Full Copy Detection" -msgstr "Пълно търсене на копиране" - -#: lib/blame.tcl:303 -msgid "Show History Context" -msgstr "Показване на контекста от историята" - -#: lib/blame.tcl:306 -msgid "Blame Parent Commit" -msgstr "Анотиране на родителското подаване" - -#: lib/blame.tcl:468 -#, tcl-format -msgid "Reading %s..." -msgstr "Чете се „%s“…" - -#: lib/blame.tcl:596 -msgid "Loading copy/move tracking annotations..." -msgstr "Зареждане на анотациите за проследяване на копирането/преместването…" - -#: lib/blame.tcl:613 -msgid "lines annotated" -msgstr "реда анотирани" - -#: lib/blame.tcl:815 -msgid "Loading original location annotations..." -msgstr "Зареждане на анотациите за първоначалното местоположение…" - -#: lib/blame.tcl:818 -msgid "Annotation complete." -msgstr "Анотирането завърши." - -#: lib/blame.tcl:849 -msgid "Busy" -msgstr "Операцията не е завършила" - -#: lib/blame.tcl:850 -msgid "Annotation process is already running." -msgstr "В момента тече процес на анотиране." - -#: lib/blame.tcl:889 -msgid "Running thorough copy detection..." -msgstr "Изпълнява се цялостен процес на откриване на копиране…" - -#: lib/blame.tcl:957 -msgid "Loading annotation..." -msgstr "Зареждане на анотации…" - -#: lib/blame.tcl:1010 -msgid "Author:" -msgstr "Автор:" - -#: lib/blame.tcl:1014 -msgid "Committer:" -msgstr "Подал:" - -#: lib/blame.tcl:1019 -msgid "Original File:" -msgstr "Първоначален файл:" - -#: lib/blame.tcl:1067 -msgid "Cannot find HEAD commit:" -msgstr "Подаването за връх „HEAD“ не може да се открие:" - -#: lib/blame.tcl:1122 -msgid "Cannot find parent commit:" -msgstr "Родителското подаване не може да се открие" - -#: lib/blame.tcl:1137 -msgid "Unable to display parent" -msgstr "Родителят не може да се покаже" - -#: lib/blame.tcl:1138 lib/diff.tcl:345 -msgid "Error loading diff:" -msgstr "Грешка при зареждане на разлика:" - -#: lib/blame.tcl:1279 -msgid "Originally By:" -msgstr "Първоначално от:" - -#: lib/blame.tcl:1285 -msgid "In File:" -msgstr "Във файл:" - -#: lib/blame.tcl:1290 -msgid "Copied Or Moved Here By:" -msgstr "Копирано или преместено тук от:" - -#: lib/diff.tcl:77 -#, tcl-format -msgid "" -"No differences detected.\n" -"\n" -"%s has no changes.\n" -"\n" -"The modification date of this file was updated by another application, but " -"the content within the file was not changed.\n" -"\n" -"A rescan will be automatically started to find other files which may have " -"the same state." -msgstr "" -"Не са открити разлики.\n" -"\n" -"Няма промени в „%s“.\n" -"\n" -"Времето на промяна на файла е бил зададен от друга програма, но съдържанието " -"му не е променено.\n" -"\n" -"Автоматично ще започне нова проверка дали няма други файлове в това " -"състояние." - -#: lib/diff.tcl:117 -#, tcl-format -msgid "Loading diff of %s..." -msgstr "Зареждане на разликите в „%s“…" - -#: lib/diff.tcl:143 -msgid "" -"LOCAL: deleted\n" -"REMOTE:\n" -msgstr "" -"ЛОКАЛНО: изтрит\n" -"ОТДАЛЕЧЕНО:\n" - -#: lib/diff.tcl:148 -msgid "" -"REMOTE: deleted\n" -"LOCAL:\n" -msgstr "" -"ОТДАЛЕЧЕНО: изтрит\n" -"ЛОКАЛНО:\n" - -#: lib/diff.tcl:155 -msgid "LOCAL:\n" -msgstr "ЛОКАЛНО:\n" - -#: lib/diff.tcl:158 -msgid "REMOTE:\n" -msgstr "ОТДАЛЕЧЕНО:\n" - -#: lib/diff.tcl:220 lib/diff.tcl:344 -#, tcl-format -msgid "Unable to display %s" -msgstr "Файлът „%s“ не може да се покаже" - -#: lib/diff.tcl:221 -msgid "Error loading file:" -msgstr "Грешка при зареждане на файл:" - -#: lib/diff.tcl:227 -msgid "Git Repository (subproject)" -msgstr "Хранилище на Git (подмодул)" - -#: lib/diff.tcl:239 -msgid "* Binary file (not showing content)." -msgstr "● Двоичен файл (съдържанието не се показва)." - -#: lib/diff.tcl:244 -#, tcl-format -msgid "" -"* Untracked file is %d bytes.\n" -"* Showing only first %d bytes.\n" -msgstr "" -"● Неследеният файл е %d байта.\n" -"● Показват се само първите %d байта.\n" - -#: lib/diff.tcl:250 -#, tcl-format -msgid "" -"\n" -"* Untracked file clipped here by %s.\n" -"* To see the entire file, use an external editor.\n" -msgstr "" -"\n" -"● Неследеният файл е отрязан дотук от програмата „%s“.\n" -"● Използвайте външен редактор, за да видите целия файл.\n" - -#: lib/diff.tcl:583 -msgid "Failed to unstage selected hunk." -msgstr "Избраното парче не може да се извади от индекса." - -#: lib/diff.tcl:591 -msgid "Failed to revert selected hunk." -msgstr "Избраното парче не може да се върне." - -#: lib/diff.tcl:594 -msgid "Failed to stage selected hunk." -msgstr "Избраното парче не може да се добави към индекса." - -#: lib/diff.tcl:687 -msgid "Failed to unstage selected line." -msgstr "Избраният ред не може да се извади от индекса." - -#: lib/diff.tcl:696 -msgid "Failed to revert selected line." -msgstr "Избраният ред не може да се върне." - -#: lib/diff.tcl:700 -msgid "Failed to stage selected line." -msgstr "Избраният ред не може да се добави към индекса." - -#: lib/diff.tcl:889 -msgid "Failed to undo last revert." -msgstr "Неуспешна отмяна на последното връщане." - -#: lib/sshkey.tcl:34 -msgid "No keys found." -msgstr "Не са открити ключове." - -#: lib/sshkey.tcl:37 -#, tcl-format -msgid "Found a public key in: %s" -msgstr "Открит е публичен ключ в „%s“" - -#: lib/sshkey.tcl:43 -msgid "Generate Key" -msgstr "Генериране на ключ" - -#: lib/sshkey.tcl:61 -msgid "Copy To Clipboard" -msgstr "Копиране към системния буфер" - -#: lib/sshkey.tcl:75 -msgid "Your OpenSSH Public Key" -msgstr "Публичният ви ключ за OpenSSH" - -#: lib/sshkey.tcl:83 -msgid "Generating..." -msgstr "Генериране…" - -#: lib/sshkey.tcl:89 -#, tcl-format -msgid "" -"Could not start ssh-keygen:\n" -"\n" -"%s" -msgstr "" -"Програмата „ssh-keygen“ не може да се стартира:\n" -"\n" -"%s" - -#: lib/sshkey.tcl:116 -msgid "Generation failed." -msgstr "Неуспешно генериране." - -#: lib/sshkey.tcl:123 -msgid "Generation succeeded, but no keys found." -msgstr "Генерирането завърши успешно, а не са намерени ключове." - -#: lib/sshkey.tcl:126 -#, tcl-format -msgid "Your key is in: %s" -msgstr "Ключът ви е в „%s“" - -#: lib/branch_create.tcl:23 -#, tcl-format -msgid "%s (%s): Create Branch" -msgstr "%s (%s): Създаване на клон" - -#: lib/branch_create.tcl:28 -msgid "Create New Branch" -msgstr "Създаване на нов клон" - -#: lib/branch_create.tcl:42 -msgid "Branch Name" -msgstr "Име на клона" - -#: lib/branch_create.tcl:57 -msgid "Match Tracking Branch Name" -msgstr "Съвпадане по името на следения клон" - -#: lib/branch_create.tcl:66 -msgid "Starting Revision" -msgstr "Начална версия" - -#: lib/branch_create.tcl:72 -msgid "Update Existing Branch:" -msgstr "Обновяване на съществуващ клон:" - -#: lib/branch_create.tcl:75 -msgid "No" -msgstr "Не" - -#: lib/branch_create.tcl:80 -msgid "Fast Forward Only" -msgstr "Само тривиално превъртащо сливане" - -#: lib/branch_create.tcl:97 -msgid "Checkout After Creation" -msgstr "Преминаване към клона след създаването му" - -#: lib/branch_create.tcl:132 -msgid "Please select a tracking branch." -msgstr "Изберете клон за следени." - -#: lib/branch_create.tcl:141 -#, tcl-format -msgid "Tracking branch %s is not a branch in the remote repository." -msgstr "Следящият клон — „%s“, не съществува в отдалеченото хранилище." - -#: lib/console.tcl:59 -msgid "Working... please wait..." -msgstr "В момента се извършва действие, изчакайте…" - -#: lib/console.tcl:186 -msgid "Success" -msgstr "Успех" - -#: lib/console.tcl:200 -msgid "Error: Command Failed" -msgstr "Грешка: неуспешно изпълнение на команда" - -#: lib/line.tcl:17 -msgid "Goto Line:" -msgstr "Към ред:" - -#: lib/line.tcl:23 -msgid "Go" -msgstr "Към" - #: lib/choose_rev.tcl:52 msgid "This Detached Checkout" msgstr "Това несвързано изтегляне" @@ -2494,7 +1459,7 @@ msgstr "" "\n" "Трябва да добавите поне един файл към индекса, за да подадете.\n" -#: lib/commit.tcl:213 +#: lib/commit.tcl:224 msgid "" "Please supply a commit message.\n" "\n" @@ -2512,15 +1477,15 @@ msgstr "" "● Втори ред: празен.\n" "● Останалите редове: опишете защо се налага тази промяна.\n" -#: lib/commit.tcl:244 +#: lib/commit.tcl:255 msgid "Calling pre-commit hook..." msgstr "Изпълняване на куката преди подаване…" -#: lib/commit.tcl:259 +#: lib/commit.tcl:270 msgid "Commit declined by pre-commit hook." msgstr "Подаването е отхвърлено от куката преди подаване." -#: lib/commit.tcl:278 +#: lib/commit.tcl:289 msgid "" "You are about to commit on a detached head. This is a potentially dangerous " "thing to do because if you switch to another branch you will lose your " @@ -2536,32 +1501,32 @@ msgstr "" " \n" "Сигурни ли сте, че искате да извършите текущото подаване?" -#: lib/commit.tcl:299 +#: lib/commit.tcl:310 msgid "Calling commit-msg hook..." msgstr "Изпълняване на куката за съобщението при подаване…" -#: lib/commit.tcl:314 +#: lib/commit.tcl:325 msgid "Commit declined by commit-msg hook." msgstr "Подаването е отхвърлено от куката за съобщението при подаване." -#: lib/commit.tcl:327 +#: lib/commit.tcl:338 msgid "Committing changes..." msgstr "Подаване на промените…" -#: lib/commit.tcl:344 +#: lib/commit.tcl:355 msgid "write-tree failed:" msgstr "неуспешно запазване на дървото (write-tree):" -#: lib/commit.tcl:345 lib/commit.tcl:395 lib/commit.tcl:422 +#: lib/commit.tcl:356 lib/commit.tcl:406 lib/commit.tcl:433 msgid "Commit failed." msgstr "Неуспешно подаване." -#: lib/commit.tcl:362 +#: lib/commit.tcl:373 #, tcl-format msgid "Commit %s appears to be corrupt" msgstr "Подаването „%s“ изглежда повредено" -#: lib/commit.tcl:367 +#: lib/commit.tcl:378 msgid "" "No changes to commit.\n" "\n" @@ -2576,63 +1541,34 @@ msgstr "" "\n" "Автоматично ще започне нова проверка.\n" -#: lib/commit.tcl:374 +#: lib/commit.tcl:385 msgid "No changes to commit." msgstr "Няма промени за подаване." -#: lib/commit.tcl:394 +#: lib/commit.tcl:405 msgid "commit-tree failed:" msgstr "неуспешно подаване на дървото (commit-tree):" -#: lib/commit.tcl:421 +#: lib/commit.tcl:432 msgid "update-ref failed:" msgstr "неуспешно обновяване на указателите (update-ref):" -#: lib/commit.tcl:514 +#: lib/commit.tcl:526 #, tcl-format msgid "Created commit %s: %s" msgstr "Успешно подаване %s: %s" -#: lib/branch_delete.tcl:16 -#, tcl-format -msgid "%s (%s): Delete Branch" -msgstr "%s (%s): Изтриване на клон" - -#: lib/branch_delete.tcl:21 -msgid "Delete Local Branch" -msgstr "Изтриване на локален клон" - -#: lib/branch_delete.tcl:39 -msgid "Local Branches" -msgstr "Локални клони" - -#: lib/branch_delete.tcl:51 -msgid "Delete Only If Merged Into" -msgstr "Изтриване, само ако промените са слети и другаде" - -#: lib/branch_delete.tcl:103 -#, tcl-format -msgid "The following branches are not completely merged into %s:" -msgstr "Не всички промени в клоните са слети в „%s“:" - -#: lib/branch_delete.tcl:131 -#, tcl-format -msgid " - %s:" -msgstr " — „%s:“" +#: lib/console.tcl:59 +msgid "Working... please wait..." +msgstr "В момента се извършва действие, изчакайте…" -#: lib/branch_delete.tcl:141 -#, tcl-format -msgid "" -"Failed to delete branches:\n" -"%s" -msgstr "" -"Неуспешно триене на клони:\n" -"%s" +#: lib/console.tcl:186 +msgid "Success" +msgstr "Успех" -#: lib/date.tcl:25 -#, tcl-format -msgid "Invalid date from Git: %s" -msgstr "Неправилни данни от Git: %s" +#: lib/console.tcl:200 +msgid "Error: Command Failed" +msgstr "Грешка: неуспешно изпълнение на команда" #: lib/database.tcl:42 msgid "Number of loose objects" @@ -2662,6 +1598,12 @@ msgstr "Пакетирани обекти за окастряне" msgid "Garbage files" msgstr "Файлове за боклука" +#: lib/database.tcl:57 lib/option.tcl:182 lib/option.tcl:197 lib/option.tcl:220 +#: lib/option.tcl:282 +#, tcl-format +msgid "%s:" +msgstr "%s:" + #: lib/database.tcl:66 #, tcl-format msgid "%s (%s): Database Statistics" @@ -2692,6 +1634,130 @@ msgstr "" "\n" "Да се започне ли компресирането?" +#: lib/date.tcl:25 +#, tcl-format +msgid "Invalid date from Git: %s" +msgstr "Неправилни данни от Git: %s" + +#: lib/diff.tcl:74 +msgid "" +"* No differences detected; stage the file to de-list it from Unstaged " +"Changes.\n" +msgstr "" +"● Няма разлики. Добавете файла към индекса, за да се извади от промените " +"извън индекса.\n" + +#: lib/diff.tcl:75 +msgid "* Click to find other files that may have the same state.\n" +msgstr "● Натиснете, за да потърсите други файлове в това състояние.\n" + +#: lib/diff.tcl:106 +#, tcl-format +msgid "Loading diff of %s..." +msgstr "Зареждане на разликите в „%s“…" + +#: lib/diff.tcl:132 +msgid "" +"LOCAL: deleted\n" +"REMOTE:\n" +msgstr "" +"ЛОКАЛНО: изтрит\n" +"ОТДАЛЕЧЕНО:\n" + +#: lib/diff.tcl:137 +msgid "" +"REMOTE: deleted\n" +"LOCAL:\n" +msgstr "" +"ОТДАЛЕЧЕНО: изтрит\n" +"ЛОКАЛНО:\n" + +#: lib/diff.tcl:144 +msgid "LOCAL:\n" +msgstr "ЛОКАЛНО:\n" + +#: lib/diff.tcl:147 +msgid "REMOTE:\n" +msgstr "ОТДАЛЕЧЕНО:\n" + +#: lib/diff.tcl:209 lib/diff.tcl:333 +#, tcl-format +msgid "Unable to display %s" +msgstr "Файлът „%s“ не може да се покаже" + +#: lib/diff.tcl:210 +msgid "Error loading file:" +msgstr "Грешка при зареждане на файл:" + +#: lib/diff.tcl:216 +msgid "Git Repository (subproject)" +msgstr "Хранилище на Git (подмодул)" + +#: lib/diff.tcl:228 +msgid "* Binary file (not showing content)." +msgstr "● Двоичен файл (съдържанието не се показва)." + +#: lib/diff.tcl:233 +#, tcl-format +msgid "" +"* Untracked file is %d bytes.\n" +"* Showing only first %d bytes.\n" +msgstr "" +"● Неследеният файл е %d байта.\n" +"● Показват се само първите %d байта.\n" + +#: lib/diff.tcl:239 +#, tcl-format +msgid "" +"\n" +"* Untracked file clipped here by %s.\n" +"* To see the entire file, use an external editor.\n" +msgstr "" +"\n" +"● Неследеният файл е отрязан дотук от програмата „%s“.\n" +"● Използвайте външен редактор, за да видите целия файл.\n" + +#: lib/diff.tcl:569 +msgid "Failed to unstage selected hunk." +msgstr "Избраното парче не може да се извади от индекса." + +#: lib/diff.tcl:577 +msgid "Failed to revert selected hunk." +msgstr "Избраното парче не може да се върне." + +#: lib/diff.tcl:580 +msgid "Failed to stage selected hunk." +msgstr "Избраното парче не може да се добави към индекса." + +#: lib/diff.tcl:673 +msgid "Failed to unstage selected line." +msgstr "Избраният ред не може да се извади от индекса." + +#: lib/diff.tcl:682 +msgid "Failed to revert selected line." +msgstr "Избраният ред не може да се върне." + +#: lib/diff.tcl:686 +msgid "Failed to stage selected line." +msgstr "Избраният ред не може да се добави към индекса." + +#: lib/diff.tcl:875 +msgid "Failed to undo last revert." +msgstr "Неуспешна отмяна на последното връщане." + +#: lib/encoding.tcl:443 +msgid "Default" +msgstr "Стандартното" + +#: lib/encoding.tcl:448 +#, tcl-format +msgid "System (%s)" +msgstr "Системното (%s)" + +#: lib/encoding.tcl:459 lib/encoding.tcl:465 +msgid "Other" +msgstr "Друго" + #: lib/error.tcl:20 #, tcl-format msgid "%s: error" @@ -2716,6 +1782,134 @@ msgstr "Преди да можете да подадете, коригирайт msgid "%s (%s): error" msgstr "%s (%s): грешка" +#: lib/index.tcl:6 +msgid "Unable to unlock the index." +msgstr "Индексът не може да се отключи." + +#: lib/index.tcl:30 +msgid "Index Error" +msgstr "Грешка в индекса" + +#: lib/index.tcl:32 +msgid "" +"Updating the Git index failed. A rescan will be automatically started to " +"resynchronize git-gui." +msgstr "" +"Неуспешно обновяване на индекса на Git. Автоматично ще започне нова проверка " +"за синхронизирането на git-gui." + +#: lib/index.tcl:43 +msgid "Continue" +msgstr "Продължаване" + +#: lib/index.tcl:46 +msgid "Unlock Index" +msgstr "Отключване на индекса" + +#: lib/index.tcl:326 +msgid "Unstaging selected files from commit" +msgstr "Изваждане на избраните файлове от подаването" + +#: lib/index.tcl:330 +#, tcl-format +msgid "Unstaging %s from commit" +msgstr "Изваждане на „%s“ от подаването" + +#: lib/index.tcl:369 +msgid "Ready to commit." +msgstr "Готовност за подаване." + +#: lib/index.tcl:378 +msgid "Adding selected files" +msgstr "Добавяне на избраните файлове" + +#: lib/index.tcl:382 +#, tcl-format +msgid "Adding %s" +msgstr "Добавяне на „%s“" + +#: lib/index.tcl:412 +#, tcl-format +msgid "Stage %d untracked files?" +msgstr "Да се добавят ли %d неследени файла към индекса?" + +#: lib/index.tcl:420 +msgid "Adding all changed files" +msgstr "Добавяне на всички променени файлове" + +#: lib/index.tcl:503 +#, tcl-format +msgid "Revert changes in file %s?" +msgstr "Да се махнат ли промените във файла „%s“?" + +#: lib/index.tcl:508 +#, tcl-format +msgid "Revert changes in these %i files?" +msgstr "Да се махнат ли промените в тези %i файла?" + +#: lib/index.tcl:517 +msgid "Any unstaged changes will be permanently lost by the revert." +msgstr "" +"Всички промени, които не са били добавени в индекса, ще се загубят " +"безвъзвратно." + +#: lib/index.tcl:520 lib/index.tcl:564 +msgid "Do Nothing" +msgstr "Нищо да не се прави" + +#: lib/index.tcl:546 +#, tcl-format +msgid "Delete untracked file %s?" +msgstr "Да се изтрие ли неследеният файл „%s“?" + +#: lib/index.tcl:551 +#, tcl-format +msgid "Delete these %i untracked files?" +msgstr "Да се изтрият ли тези %d неследени файла?" + +#: lib/index.tcl:561 +msgid "Files will be permanently deleted." +msgstr "Файловете ще се изтрият окончателно." + +#: lib/index.tcl:565 +msgid "Delete Files" +msgstr "Изтриване на файлове" + +#: lib/index.tcl:588 +msgid "Deleting" +msgstr "Изтриване" + +#: lib/index.tcl:667 +msgid "Encountered errors deleting files:\n" +msgstr "Грешки при изтриване на файловете:\n" + +#: lib/index.tcl:676 +#, tcl-format +msgid "None of the %d selected files could be deleted." +msgstr "Никой от избраните %d файла не бе изтрит." + +#: lib/index.tcl:681 +#, tcl-format +msgid "%d of the %d selected files could not be deleted." +msgstr "%d от избраните %d файла не бяха изтрити." + +#: lib/index.tcl:728 +msgid "Reverting selected files" +msgstr "Махане на промените в избраните файлове" + +#: lib/index.tcl:732 +#, tcl-format +msgid "Reverting %s" +msgstr "Махане на промените в „%s“" + +#: lib/line.tcl:17 +msgid "Goto Line:" +msgstr "Към ред:" + +#: lib/line.tcl:23 +msgid "Go" +msgstr "Към" + #: lib/merge.tcl:13 msgid "" "Cannot merge while amending.\n" @@ -2864,3 +2058,775 @@ msgstr "Неуспешно преустановяване." #: lib/merge.tcl:279 msgid "Abort completed. Ready." msgstr "Успешно преустановяване. Готовност за следващо действие." + +#: lib/mergetool.tcl:8 +msgid "Force resolution to the base version?" +msgstr "Да се използва базовата версия" + +#: lib/mergetool.tcl:9 +msgid "Force resolution to this branch?" +msgstr "Да се използва версията от този клон" + +#: lib/mergetool.tcl:10 +msgid "Force resolution to the other branch?" +msgstr "Да се използва версията от другия клон" + +#: lib/mergetool.tcl:14 +#, tcl-format +msgid "" +"Note that the diff shows only conflicting changes.\n" +"\n" +"%s will be overwritten.\n" +"\n" +"This operation can be undone only by restarting the merge." +msgstr "" +"Разликата показва само разликите с конфликт.\n" +"\n" +"Файлът „%s“ ще се презапише.\n" +"\n" +"Тази операция може да се отмени само чрез започване на сливането наново." + +#: lib/mergetool.tcl:45 +#, tcl-format +msgid "File %s seems to have unresolved conflicts, still stage?" +msgstr "" +"Изглежда, че все още има некоригирани конфликти във файла „%s“. Да се добави " +"ли файлът към индекса?" + +#: lib/mergetool.tcl:60 +#, tcl-format +msgid "Adding resolution for %s" +msgstr "Добавяне на корекция на конфликтите в „%s“" + +#: lib/mergetool.tcl:141 +msgid "Cannot resolve deletion or link conflicts using a tool" +msgstr "" +"Конфликтите при символни връзки или изтриване не може да се коригират с " +"външна програма." + +#: lib/mergetool.tcl:146 +msgid "Conflict file does not exist" +msgstr "Файлът, в който е конфликтът, не съществува" + +#: lib/mergetool.tcl:246 +#, tcl-format +msgid "Not a GUI merge tool: '%s'" +msgstr "Това не е графична програма за сливане: „%s“" + +#: lib/mergetool.tcl:278 +#, tcl-format +msgid "" +"Unable to process square brackets in \"mergetool.%s.cmd\" configuration " +"option.\n" +"\n" +"Please remove the square brackets." +msgstr "" +"Квадратните скоби в настройката „mergetool.%s.cmd“ не може да се обработят.\n" +"\n" +"Махнете ги." + +#: lib/mergetool.tcl:289 +#, tcl-format +msgid "" +"Unsupported merge tool '%s'.\n" +"\n" +"To use this tool, configure \"mergetool.%s.cmd\" as shown in the git-config " +"manual page." +msgstr "" +"Неподдържана програма за сливане: „%s“.\n" +"\n" +"За да я използвате, настройте „mergetool.%s.cmd“ както както е обяснено в " +"страницата на ръководството за „git-config“." + +#: lib/mergetool.tcl:327 +msgid "Merge tool is already running, terminate it?" +msgstr "Програмата за сливане вече е стартирана. Да се изключи ли?" + +#: lib/mergetool.tcl:347 +#, tcl-format +msgid "" +"Error retrieving versions:\n" +"%s" +msgstr "" +"Грешка при изтеглянето на версии:\n" +"%s" + +#: lib/mergetool.tcl:367 +#, tcl-format +msgid "" +"Could not start the merge tool:\n" +"\n" +"%s" +msgstr "" +"Програмата за сливане не може да се стартира:\n" +"\n" +"%s" + +#: lib/mergetool.tcl:371 +msgid "Running merge tool..." +msgstr "Стартиране на програмата за сливане…" + +#: lib/mergetool.tcl:399 lib/mergetool.tcl:407 +msgid "Merge tool failed." +msgstr "Грешка в програмата за сливане." + +#: lib/option.tcl:11 +#, tcl-format +msgid "Invalid global encoding '%s'" +msgstr "Неправилно глобално кодиране „%s“" + +#: lib/option.tcl:19 +#, tcl-format +msgid "Invalid repo encoding '%s'" +msgstr "Неправилно кодиране „%s“ на хранилището" + +#: lib/option.tcl:119 +msgid "Restore Defaults" +msgstr "Стандартни настройки" + +#: lib/option.tcl:123 +msgid "Save" +msgstr "Запазване" + +#: lib/option.tcl:133 +#, tcl-format +msgid "%s Repository" +msgstr "Хранилище „%s“" + +#: lib/option.tcl:134 +msgid "Global (All Repositories)" +msgstr "Глобално (за всички хранилища)" + +#: lib/option.tcl:140 +msgid "User Name" +msgstr "Потребителско име" + +#: lib/option.tcl:141 +msgid "Email Address" +msgstr "Адрес на е-поща" + +#: lib/option.tcl:143 +msgid "Summarize Merge Commits" +msgstr "Обобщаване на подаванията при сливане" + +#: lib/option.tcl:144 +msgid "Merge Verbosity" +msgstr "Подробности при сливанията" + +#: lib/option.tcl:145 +msgid "Show Diffstat After Merge" +msgstr "Извеждане на статистика след сливанията" + +#: lib/option.tcl:146 +msgid "Use Merge Tool" +msgstr "Използване на програма за сливане" + +#: lib/option.tcl:148 +msgid "Trust File Modification Timestamps" +msgstr "Доверие във времето на промяна на файловете" + +#: lib/option.tcl:149 +msgid "Prune Tracking Branches During Fetch" +msgstr "Окастряне на следящите клонове при доставяне" + +#: lib/option.tcl:150 +msgid "Match Tracking Branches" +msgstr "Напасване на следящите клонове" + +#: lib/option.tcl:151 +msgid "Use Textconv For Diffs and Blames" +msgstr "Използване на „textconv“ за разликите и анотирането" + +#: lib/option.tcl:152 +msgid "Blame Copy Only On Changed Files" +msgstr "Анотиране на копието само по променените файлове" + +#: lib/option.tcl:153 +msgid "Maximum Length of Recent Repositories List" +msgstr "Максимален брой на списъка „Скоро ползвани“ хранилища" + +#: lib/option.tcl:154 +msgid "Minimum Letters To Blame Copy On" +msgstr "Минимален брой знаци за анотиране на копието" + +#: lib/option.tcl:155 +msgid "Blame History Context Radius (days)" +msgstr "Исторически обхват за анотиране в дни" + +#: lib/option.tcl:156 +msgid "Number of Diff Context Lines" +msgstr "Брой редове за контекста на разликите" + +#: lib/option.tcl:157 +msgid "Additional Diff Parameters" +msgstr "Аргументи към командата за разликите" + +#: lib/option.tcl:158 +msgid "Commit Message Text Width" +msgstr "Широчина на текста на съобщението при подаване" + +#: lib/option.tcl:159 +msgid "New Branch Name Template" +msgstr "Шаблон за името на новите клони" + +#: lib/option.tcl:160 +msgid "Default File Contents Encoding" +msgstr "Кодиране на файловете" + +#: lib/option.tcl:161 +msgid "Warn before committing to a detached head" +msgstr "Предупреждаване при подаване към несвързан указател" + +#: lib/option.tcl:162 +msgid "Staging of untracked files" +msgstr "Добавяне на неследените файлове към индекса" + +#: lib/option.tcl:163 +msgid "Show untracked files" +msgstr "Показване на неследените файлове" + +#: lib/option.tcl:164 +msgid "Tab spacing" +msgstr "Ширина на табулацията" + +#: lib/option.tcl:210 +msgid "Change" +msgstr "Смяна" + +#: lib/option.tcl:254 +msgid "Spelling Dictionary:" +msgstr "Правописен речник:" + +#: lib/option.tcl:284 +msgid "Change Font" +msgstr "Смяна на шрифта" + +#: lib/option.tcl:288 +#, tcl-format +msgid "Choose %s" +msgstr "Избор на „%s“" + +#: lib/option.tcl:294 +msgid "pt." +msgstr "тчк." + +#: lib/option.tcl:308 +msgid "Preferences" +msgstr "Настройки" + +#: lib/option.tcl:345 +msgid "Failed to completely save options:" +msgstr "Неуспешно запазване на настройките:" + +#: lib/remote_add.tcl:20 +#, tcl-format +msgid "%s (%s): Add Remote" +msgstr "%s (%s): Добавяне на отдалечено хранилище" + +#: lib/remote_add.tcl:25 +msgid "Add New Remote" +msgstr "Добавяне на отдалечено хранилище" + +#: lib/remote_add.tcl:30 lib/tools_dlg.tcl:37 +msgid "Add" +msgstr "Добавяне" + +#: lib/remote_add.tcl:39 +msgid "Remote Details" +msgstr "Данни за отдалеченото хранилище" + +#: lib/remote_add.tcl:50 +msgid "Location:" +msgstr "Местоположение:" + +#: lib/remote_add.tcl:60 +msgid "Further Action" +msgstr "Следващо действие" + +#: lib/remote_add.tcl:63 +msgid "Fetch Immediately" +msgstr "Незабавно доставяне" + +#: lib/remote_add.tcl:69 +msgid "Initialize Remote Repository and Push" +msgstr "Инициализиране на отдалеченото хранилище и изтласкване на промените" + +#: lib/remote_add.tcl:75 +msgid "Do Nothing Else Now" +msgstr "Да не се прави нищо" + +#: lib/remote_add.tcl:100 +msgid "Please supply a remote name." +msgstr "Задайте име за отдалеченото хранилище." + +#: lib/remote_add.tcl:113 +#, tcl-format +msgid "'%s' is not an acceptable remote name." +msgstr "Отдалечено хранилище не може да се казва „%s“." + +#: lib/remote_add.tcl:124 +#, tcl-format +msgid "Failed to add remote '%s' of location '%s'." +msgstr "Неуспешно добавяне на отдалеченото хранилище „%s“ от адрес „%s“." + +#: lib/remote_add.tcl:132 lib/transport.tcl:6 +#, tcl-format +msgid "fetch %s" +msgstr "доставяне на „%s“" + +#: lib/remote_add.tcl:133 +#, tcl-format +msgid "Fetching the %s" +msgstr "Доставяне на „%s“" + +#: lib/remote_add.tcl:156 +#, tcl-format +msgid "Do not know how to initialize repository at location '%s'." +msgstr "Хранилището с местоположение „%s“ не може да се инициализира." + +#: lib/remote_add.tcl:162 lib/transport.tcl:54 lib/transport.tcl:92 +#: lib/transport.tcl:110 +#, tcl-format +msgid "push %s" +msgstr "изтласкване на „%s“" + +#: lib/remote_add.tcl:163 +#, tcl-format +msgid "Setting up the %s (at %s)" +msgstr "Добавяне на хранилище „%s“ (с адрес „%s“)" + +#: lib/remote_branch_delete.tcl:29 +#, tcl-format +msgid "%s (%s): Delete Branch Remotely" +msgstr "%s (%s): Изтриване на отдалечения клон" + +#: lib/remote_branch_delete.tcl:34 +msgid "Delete Branch Remotely" +msgstr "Изтриване на отдалечения клон" + +#: lib/remote_branch_delete.tcl:48 +msgid "From Repository" +msgstr "От хранилище" + +#: lib/remote_branch_delete.tcl:51 lib/transport.tcl:165 +msgid "Remote:" +msgstr "Отдалечено хранилище:" + +#: lib/remote_branch_delete.tcl:72 lib/transport.tcl:187 +msgid "Arbitrary Location:" +msgstr "Произволно местоположение:" + +#: lib/remote_branch_delete.tcl:88 +msgid "Branches" +msgstr "Клони" + +#: lib/remote_branch_delete.tcl:110 +msgid "Delete Only If" +msgstr "Изтриване, само ако" + +#: lib/remote_branch_delete.tcl:112 +msgid "Merged Into:" +msgstr "Слят в:" + +#: lib/remote_branch_delete.tcl:153 +msgid "A branch is required for 'Merged Into'." +msgstr "За данните „Слят в“ е необходимо да зададете клон." + +#: lib/remote_branch_delete.tcl:185 +#, tcl-format +msgid "" +"The following branches are not completely merged into %s:\n" +"\n" +" - %s" +msgstr "" +"Следните клони не са слети напълно в „%s“:\n" +"\n" +" ● %s" + +#: lib/remote_branch_delete.tcl:190 +#, tcl-format +msgid "" +"One or more of the merge tests failed because you have not fetched the " +"necessary commits. Try fetching from %s first." +msgstr "" +"Поне една от пробите за сливане е неуспешна, защото не сте доставили всички " +"необходими подавания. Пробвайте първо да доставите подаванията от „%s“." + +#: lib/remote_branch_delete.tcl:208 +msgid "Please select one or more branches to delete." +msgstr "Изберете поне един клон за изтриване." + +#: lib/remote_branch_delete.tcl:227 +#, tcl-format +msgid "Deleting branches from %s" +msgstr "Изтриване на клони от „%s“" + +#: lib/remote_branch_delete.tcl:300 +msgid "No repository selected." +msgstr "Не е избрано хранилище." + +#: lib/remote_branch_delete.tcl:305 +#, tcl-format +msgid "Scanning %s..." +msgstr "Претърсване на „%s“…" + +#: lib/remote.tcl:200 +msgid "Push to" +msgstr "Изтласкване към" + +#: lib/remote.tcl:218 +msgid "Remove Remote" +msgstr "Премахване на отдалечено хранилище" + +#: lib/remote.tcl:223 +msgid "Prune from" +msgstr "Окастряне от" + +#: lib/remote.tcl:228 +msgid "Fetch from" +msgstr "Доставяне от" + +#: lib/remote.tcl:249 lib/remote.tcl:253 lib/remote.tcl:258 lib/remote.tcl:264 +msgid "All" +msgstr "Всички" + +#: lib/search.tcl:48 +msgid "Find:" +msgstr "Търсене:" + +#: lib/search.tcl:50 +msgid "Next" +msgstr "Следваща поява" + +#: lib/search.tcl:51 +msgid "Prev" +msgstr "Предишна поява" + +#: lib/search.tcl:52 +msgid "RegExp" +msgstr "РегИзр" + +#: lib/search.tcl:54 +msgid "Case" +msgstr "Главни/Малки" + +#: lib/shortcut.tcl:8 lib/shortcut.tcl:40 lib/shortcut.tcl:72 +#, tcl-format +msgid "%s (%s): Create Desktop Icon" +msgstr "%s (%s): Добавяне на икона на работния плот" + +#: lib/shortcut.tcl:24 lib/shortcut.tcl:62 +msgid "Cannot write shortcut:" +msgstr "Клавишната комбинация не може да се запази:" + +#: lib/shortcut.tcl:137 +msgid "Cannot write icon:" +msgstr "Иконата не може да се запази:" + +#: lib/spellcheck.tcl:57 +msgid "Unsupported spell checker" +msgstr "Тази програма за проверка на правописа не се поддържа" + +#: lib/spellcheck.tcl:65 +msgid "Spell checking is unavailable" +msgstr "Липсва програма за проверка на правописа" + +#: lib/spellcheck.tcl:68 +msgid "Invalid spell checking configuration" +msgstr "Неправилни настройки на проверката на правописа" + +#: lib/spellcheck.tcl:70 +#, tcl-format +msgid "Reverting dictionary to %s." +msgstr "Ползване на речник за език „%s“." + +#: lib/spellcheck.tcl:73 +msgid "Spell checker silently failed on startup" +msgstr "Програмата за правопис даже не стартира успешно." + +#: lib/spellcheck.tcl:80 +msgid "Unrecognized spell checker" +msgstr "Непозната програма за проверка на правописа" + +#: lib/spellcheck.tcl:186 +msgid "No Suggestions" +msgstr "Няма предложения" + +#: lib/spellcheck.tcl:388 +msgid "Unexpected EOF from spell checker" +msgstr "Неочакван край на файл от програмата за проверка на правописа" + +#: lib/spellcheck.tcl:392 +msgid "Spell Checker Failed" +msgstr "Грешка в програмата за проверка на правописа" + +#: lib/sshkey.tcl:34 +msgid "No keys found." +msgstr "Не са открити ключове." + +#: lib/sshkey.tcl:37 +#, tcl-format +msgid "Found a public key in: %s" +msgstr "Открит е публичен ключ в „%s“" + +#: lib/sshkey.tcl:43 +msgid "Generate Key" +msgstr "Генериране на ключ" + +#: lib/sshkey.tcl:61 +msgid "Copy To Clipboard" +msgstr "Копиране към системния буфер" + +#: lib/sshkey.tcl:75 +msgid "Your OpenSSH Public Key" +msgstr "Публичният ви ключ за OpenSSH" + +#: lib/sshkey.tcl:83 +msgid "Generating..." +msgstr "Генериране…" + +#: lib/sshkey.tcl:89 +#, tcl-format +msgid "" +"Could not start ssh-keygen:\n" +"\n" +"%s" +msgstr "" +"Програмата „ssh-keygen“ не може да се стартира:\n" +"\n" +"%s" + +#: lib/sshkey.tcl:116 +msgid "Generation failed." +msgstr "Неуспешно генериране." + +#: lib/sshkey.tcl:123 +msgid "Generation succeeded, but no keys found." +msgstr "Генерирането завърши успешно, а не са намерени ключове." + +#: lib/sshkey.tcl:126 +#, tcl-format +msgid "Your key is in: %s" +msgstr "Ключът ви е в „%s“" + +#: lib/status_bar.tcl:263 +#, tcl-format +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s… %*i от общо %*i %s (%3i%%)" + +#: lib/tools_dlg.tcl:22 +#, tcl-format +msgid "%s (%s): Add Tool" +msgstr "%s (%s): Добавяне на команда" + +#: lib/tools_dlg.tcl:28 +msgid "Add New Tool Command" +msgstr "Добавяне на команда" + +#: lib/tools_dlg.tcl:34 +msgid "Add globally" +msgstr "Глобално добавяне" + +#: lib/tools_dlg.tcl:46 +msgid "Tool Details" +msgstr "Подробности за командата" + +#: lib/tools_dlg.tcl:49 +msgid "Use '/' separators to create a submenu tree:" +msgstr "За създаване на подменюта използвайте знака „/“ за разделител:" + +#: lib/tools_dlg.tcl:60 +msgid "Command:" +msgstr "Команда:" + +#: lib/tools_dlg.tcl:71 +msgid "Show a dialog before running" +msgstr "Преди изпълнение да се извежда диалогов прозорец" + +#: lib/tools_dlg.tcl:77 +msgid "Ask the user to select a revision (sets $REVISION)" +msgstr "Потребителят да укаже версия (задаване на променливата $REVISION)" + +#: lib/tools_dlg.tcl:82 +msgid "Ask the user for additional arguments (sets $ARGS)" +msgstr "" +"Потребителят да укаже допълнителни аргументи (задаване на променливата $ARGS)" + +#: lib/tools_dlg.tcl:89 +msgid "Don't show the command output window" +msgstr "Без показване на прозорец с изхода от командата" + +#: lib/tools_dlg.tcl:94 +msgid "Run only if a diff is selected ($FILENAME not empty)" +msgstr "" +"Стартиране само след избор на разлика (променливата $FILENAME не е празна)" + +#: lib/tools_dlg.tcl:118 +msgid "Please supply a name for the tool." +msgstr "Задайте име за командата." + +#: lib/tools_dlg.tcl:126 +#, tcl-format +msgid "Tool '%s' already exists." +msgstr "Командата „%s“ вече съществува." + +#: lib/tools_dlg.tcl:148 +#, tcl-format +msgid "" +"Could not add tool:\n" +"%s" +msgstr "" +"Командата не може да се добави:\n" +"%s" + +#: lib/tools_dlg.tcl:187 +#, tcl-format +msgid "%s (%s): Remove Tool" +msgstr "%s (%s): Премахване на команда" + +#: lib/tools_dlg.tcl:193 +msgid "Remove Tool Commands" +msgstr "Премахване на команди" + +#: lib/tools_dlg.tcl:198 +msgid "Remove" +msgstr "Премахване" + +#: lib/tools_dlg.tcl:231 +msgid "(Blue denotes repository-local tools)" +msgstr "(командите към локалното хранилище са обозначени в синьо)" + +#: lib/tools_dlg.tcl:283 +#, tcl-format +msgid "%s (%s):" +msgstr "%s (%s):" + +#: lib/tools_dlg.tcl:292 +#, tcl-format +msgid "Run Command: %s" +msgstr "Изпълнение на командата „%s“" + +#: lib/tools_dlg.tcl:306 +msgid "Arguments" +msgstr "Аргументи" + +#: lib/tools_dlg.tcl:341 +msgid "OK" +msgstr "Добре" + +#: lib/tools.tcl:76 +#, tcl-format +msgid "Running %s requires a selected file." +msgstr "За изпълнението на „%s“ трябва да изберете файл." + +#: lib/tools.tcl:92 +#, tcl-format +msgid "Are you sure you want to run %1$s on file \"%2$s\"?" +msgstr "Сигурни ли сте, че искате да изпълните „%1$s“ върху файла „%2$s“?" + +#: lib/tools.tcl:96 +#, tcl-format +msgid "Are you sure you want to run %s?" +msgstr "Сигурни ли сте, че искате да изпълните „%s“?" + +#: lib/tools.tcl:118 +#, tcl-format +msgid "Tool: %s" +msgstr "Команда: %s" + +#: lib/tools.tcl:119 +#, tcl-format +msgid "Running: %s" +msgstr "Изпълнение: %s" + +#: lib/tools.tcl:158 +#, tcl-format +msgid "Tool completed successfully: %s" +msgstr "Командата завърши успешно: %s" + +#: lib/tools.tcl:160 +#, tcl-format +msgid "Tool failed: %s" +msgstr "Командата върна грешка: %s" + +#: lib/transport.tcl:7 +#, tcl-format +msgid "Fetching new changes from %s" +msgstr "Доставяне на промените от „%s“" + +#: lib/transport.tcl:18 +#, tcl-format +msgid "remote prune %s" +msgstr "окастряне на следящите клони към „%s“" + +#: lib/transport.tcl:19 +#, tcl-format +msgid "Pruning tracking branches deleted from %s" +msgstr "Окастряне на следящите клони на изтритите клони от „%s“" + +#: lib/transport.tcl:25 +msgid "fetch all remotes" +msgstr "доставяне от всички отдалечени" + +#: lib/transport.tcl:26 +msgid "Fetching new changes from all remotes" +msgstr "Доставяне на промените от всички отдалечени хранилища" + +#: lib/transport.tcl:40 +msgid "remote prune all remotes" +msgstr "окастряне на следящите изтрити" + +#: lib/transport.tcl:41 +msgid "Pruning tracking branches deleted from all remotes" +msgstr "" +"Окастряне на следящите клони на изтритите клони от всички отдалечени " +"хранилища" + +#: lib/transport.tcl:55 +#, tcl-format +msgid "Pushing changes to %s" +msgstr "Изтласкване на промените към „%s“" + +#: lib/transport.tcl:93 +#, tcl-format +msgid "Mirroring to %s" +msgstr "Изтласкване на всичко към „%s“" + +#: lib/transport.tcl:111 +#, tcl-format +msgid "Pushing %s %s to %s" +msgstr "Изтласкване на %s „%s“ към „%s“" + +#: lib/transport.tcl:132 +msgid "Push Branches" +msgstr "Клони за изтласкване" + +#: lib/transport.tcl:147 +msgid "Source Branches" +msgstr "Клони-източници" + +#: lib/transport.tcl:162 +msgid "Destination Repository" +msgstr "Целево хранилище" + +#: lib/transport.tcl:205 +msgid "Transfer Options" +msgstr "Настройки при пренасянето" + +#: lib/transport.tcl:207 +msgid "Force overwrite existing branch (may discard changes)" +msgstr "" +"Изрично презаписване на съществуващ клон (някои промени може да се загубят)" + +#: lib/transport.tcl:211 +msgid "Use thin pack (for slow network connections)" +msgstr "Максимална компресия (за бавни мрежови връзки)" + +#: lib/transport.tcl:215 +msgid "Include tags" +msgstr "Включване на етикетите" + +#: lib/transport.tcl:229 +#, tcl-format +msgid "%s (%s): Push" +msgstr "%s (%s): Изтласкване" diff --git a/git-send-email.perl b/git-send-email.perl index cb6dca2500..437f8ac46a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -2112,6 +2112,17 @@ if ($validate) { } } + # Validate the SMTP server port, if provided. + if (defined $smtp_server_port) { + my $port = Git::port_num($smtp_server_port); + if ($port) { + $smtp_server_port = $port; + } else { + die sprintf(__("error: invalid SMTP port '%s'\n"), + $smtp_server_port); + } + } + # Run the loop once again to avoid gaps in the counter due to FIFO # arguments provided by the user. my $num = 1; diff --git a/gitk-git/gitk b/gitk-git/gitk index 5be8b2aeb0..427a8a96c9 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -7,7 +7,31 @@ exec wish "$0" -- "$@" # and distributed under the terms of the GNU General Public Licence, # either version 2, or (at your option) any later version. -package require Tk +if {[catch {package require Tcl 8.6-8.8} err]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title "gitk: fatal error" \ + -message $err + exit 1 +} + +set MIN_GIT_VERSION 2.20 +regexp {^git version ([\d.]*\d)} [exec git version] _ git_version +if {[package vcompare $git_version $MIN_GIT_VERSION] < 0} { + set message "The git executable found is too old. +The minimum required version is $MIN_GIT_VERSION.0. +The version of git found is $git_version." + + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title "gitk: fatal error" \ + -message $message + exit 1 +} ###################################################################### ## @@ -345,7 +369,7 @@ proc unmerged_files {files} { proc parseviewargs {n arglist} { global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env global vinlinediff - global worddiff git_version + global worddiff set vdatemode($n) 0 set vmergeonly($n) 0 @@ -396,14 +420,10 @@ proc parseviewargs {n arglist} { "--color-words*" - "--word-diff=color" { # These trigger a word diff in the console interface, # so help the user by enabling our own support - if {[package vcompare $git_version "1.7.2"] >= 0} { - set worddiff [mc "Color words"] - } + set worddiff [mc "Color words"] } "--word-diff*" { - if {[package vcompare $git_version "1.7.2"] >= 0} { - set worddiff [mc "Markup words"] - } + set worddiff [mc "Markup words"] } "--stat=*" - "--numstat" - "--shortstat" - "--summary" - "--check" - "--exit-code" - "--quiet" - "--topo-order" - @@ -479,6 +499,7 @@ proc parseviewargs {n arglist} { proc parseviewrevs {view revs} { global vposids vnegids + global hashlength if {$revs eq {}} { set revs HEAD @@ -492,7 +513,7 @@ proc parseviewrevs {view revs} { set badrev {} for {set l 0} {$l < [llength $errlines]} {incr l} { set line [lindex $errlines $l] - if {!([string length $line] == 40 && [string is xdigit $line])} { + if {!([string length $line] == $hashlength && [string is xdigit $line])} { if {[string match "fatal:*" $line]} { if {[string match "fatal: ambiguous argument*" $line] && $badrev ne {}} { @@ -551,7 +572,6 @@ proc start_rev_list {view} { global viewactive viewinstances vmergeonly global mainheadid viewmainheadid viewmainheadid_orig global vcanopt vflags vrevs vorigargs - global show_notes set startmsecs [clock clicks -milliseconds] set commitidx($view) 0 @@ -601,7 +621,7 @@ proc start_rev_list {view} { } if {[catch { - set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \ + set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \ --parents --boundary $args --stdin] \ [list "<<[join [concat $revs "--" $files] "\n"]"]] } err]} { @@ -697,7 +717,7 @@ proc updatecommits {} { global mainheadid viewmainheadid viewmainheadid_orig pending_select global hasworktree global varcid vposids vnegids vflags vrevs - global show_notes + global hashlength set hasworktree [hasworktree] rereadrefs @@ -731,7 +751,7 @@ proc updatecommits {} { # take out positive refs that we asked for before or # that we have already seen foreach rev $revs { - if {[string length $rev] == 40} { + if {[string length $rev] == $hashlength} { if {[lsearch -exact $oldpos $rev] < 0 && ![info exists varcid($view,$rev)]} { lappend newrevs $rev @@ -754,7 +774,7 @@ proc updatecommits {} { set args $vorigargs($view) } if {[catch { - set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \ + set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \ --parents --boundary $args --stdin] \ [list "<<[join [concat $revs "--" $vfilelimit($view)] "\n"]"]] } err]} { @@ -1614,6 +1634,7 @@ proc getcommitlines {fd inst view updating} { global parents children curview hlview global idpending ordertok global varccommits varcid varctok vtokmod vfilelimit vshortids + global hashlength set stuff [read $fd 500000] # git log doesn't terminate the last commit with a null... @@ -1696,7 +1717,7 @@ proc getcommitlines {fd inst view updating} { } set ok 1 foreach id $ids { - if {[string length $id] != 40} { + if {[string length $id] != $hashlength} { set ok 0 break } @@ -1942,8 +1963,8 @@ proc getcommit {id} { return 1 } -# Expand an abbreviated commit ID to a list of full 40-char IDs that match -# and are present in the current view. +# Expand an abbreviated commit ID to a list of full 40-char (or 64-char +# for SHA256 repo) IDs that match and are present in the current view. # This is fairly slow... proc longid {prefix} { global varcid curview vshortids @@ -1971,13 +1992,14 @@ proc longid {prefix} { } proc readrefs {} { - global tagids idtags headids idheads tagobjid + global tagids idtags headids idheads tagobjid upstreamofref global otherrefids idotherrefs mainhead mainheadid global selecthead selectheadid global hideremotes global tclencoding + global hashlength - foreach v {tagids idtags headids idheads otherrefids idotherrefs} { + foreach v {tagids idtags headids idheads otherrefids idotherrefs upstreamofref} { unset -nocomplain $v } set refd [safe_open_command [list git show-ref -d]] @@ -1985,9 +2007,9 @@ proc readrefs {} { fconfigure $refd -encoding $tclencoding } while {[gets $refd line] >= 0} { - if {[string index $line 40] ne " "} continue - set id [string range $line 0 39] - set ref [string range $line 41 end] + if {[string index $line $hashlength] ne " "} continue + set id [string range $line 0 [expr {$hashlength - 1}]] + set ref [string range $line [expr {$hashlength + 1}] end] if {![string match "refs/*" $ref]} continue set name [string range $ref 5 end] if {[string match "remotes/*" $name]} { @@ -2031,6 +2053,17 @@ proc readrefs {} { set selectheadid [safe_exec [list git rev-parse --verify $selecthead]] } } + #load the local_branch->upstream mapping + # the result of the for-each-ref command produces: local_branch NUL upstream + set refd [safe_open_command [list git for-each-ref {--format=%(refname:short)%00%(upstream)} refs/heads/]] + while {[gets $refd local_tracking] >= 0} { + set line [split $local_tracking \0] + if {[lindex $line 1] ne {}} { + set upstream_ref [string map {"refs/" ""} [lindex $line 1]] + set upstreamofref([lindex $line 0]) $upstream_ref + } + } + catch {close $refd} } # skip over fake commits @@ -2071,23 +2104,12 @@ proc removehead {id name} { } proc ttk_toplevel {w args} { - global use_ttk eval [linsert $args 0 ::toplevel $w] - if {$use_ttk} { - place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1 - } + place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1 return $w } proc make_transient {window origin} { - global have_tk85 - - # In MacOS Tk 8.4 transient appears to work by setting - # overrideredirect, which is utterly useless, since the - # windows get no border, and are not even kept above - # the parent. - if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return - wm transient $window $origin # Windows fails to place transient windows normally, so @@ -2098,12 +2120,10 @@ proc make_transient {window origin} { } proc show_error {w top msg} { - global NS - if {![info exists NS]} {set NS ""} if {[wm state $top] eq "withdrawn"} { wm deiconify $top } message $w.m -text $msg -justify center -aspect 400 pack $w.m -side top -fill x -padx 20 -pady 20 - ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top" + ttk::button $w.ok -default active -text [mc OK] -command "destroy $top" pack $w.ok -side bottom -fill x bind $top <Visibility> "grab $top; focus $top" bind $top <Key-Return> "destroy $top" @@ -2125,16 +2145,16 @@ proc error_popup {msg {owner .}} { } proc confirm_popup {msg {owner .}} { - global confirm_ok NS + global confirm_ok set confirm_ok 0 set w .confirm ttk_toplevel $w make_transient $w $owner message $w.m -text $msg -justify center -aspect 400 pack $w.m -side top -fill x -padx 20 -pady 20 - ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" + ttk::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" pack $w.ok -side left -fill x - ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" + ttk::button $w.cancel -text [mc Cancel] -command "destroy $w" pack $w.cancel -side right -fill x bind $w <Visibility> "grab $w; focus $w" bind $w <Key-Return> "set confirm_ok 1; destroy $w" @@ -2150,8 +2170,6 @@ proc haveselectionclipboard {} { } proc setoptions {} { - global use_ttk - if {[tk windowingsystem] ne "win32"} { option add *Panedwindow.showHandle 1 startupFile option add *Panedwindow.sashRelief raised startupFile @@ -2244,23 +2262,52 @@ proc cleardropsel {w} { $w selection clear } proc makedroplist {w varname args} { - global use_ttk - if {$use_ttk} { - set width 0 - foreach label $args { - set cx [string length $label] - if {$cx > $width} {set width $cx} - } - set gm [ttk::combobox $w -width $width -state readonly\ - -textvariable $varname -values $args \ - -exportselection false] - bind $gm <<ComboboxSelected>> [list $gm selection clear] - } else { - set gm [eval [linsert $args 0 tk_optionMenu $w $varname]] - } + set width 0 + foreach label $args { + set cx [string length $label] + if {$cx > $width} {set width $cx} + } + set gm [ttk::combobox $w -width $width -state readonly\ + -textvariable $varname -values $args \ + -exportselection false] + bind $gm <<ComboboxSelected>> [list $gm selection clear] return $gm } +proc scrollval {D {koff 0}} { + global kscroll scroll_D0 + return [expr int(-($D / $scroll_D0) * max(1, $kscroll-$koff))] +} + +proc bind_mousewheel {} { + global canv cflist ctext + bindall <MouseWheel> {allcanvs yview scroll [scrollval %D] units} + bindall <Shift-MouseWheel> break + bind $ctext <MouseWheel> {$ctext yview scroll [scrollval %D 2] units} + bind $ctext <Shift-MouseWheel> {$ctext xview scroll [scrollval %D 2] units} + bind $cflist <MouseWheel> {$cflist yview scroll [scrollval %D 2] units} + bind $cflist <Shift-MouseWheel> break + bind $canv <Shift-MouseWheel> {$canv xview scroll [scrollval %D] units} +} + +proc bind_mousewheel_buttons {} { + global canv cflist ctext + bindall <ButtonRelease-4> {allcanvs yview scroll [scrollval 1] units} + bindall <ButtonRelease-5> {allcanvs yview scroll [scrollval -1] units} + bindall <Shift-ButtonRelease-4> break + bindall <Shift-ButtonRelease-5> break + bind $ctext <ButtonRelease-4> {$ctext yview scroll [scrollval 1 2] units} + bind $ctext <ButtonRelease-5> {$ctext yview scroll [scrollval -1 2] units} + bind $ctext <Shift-ButtonRelease-4> {$ctext xview scroll [scrollval 1 2] units} + bind $ctext <Shift-ButtonRelease-5> {$ctext xview scroll [scrollval -1 2] units} + bind $cflist <ButtonRelease-4> {$cflist yview scroll [scrollval 1 2] units} + bind $cflist <ButtonRelease-5> {$cflist yview scroll [scrollval -1 2] units} + bind $cflist <Shift-ButtonRelease-4> break + bind $cflist <Shift-ButtonRelease-5> break + bind $canv <Shift-ButtonRelease-4> {$canv xview scroll [scrollval 1] units} + bind $canv <Shift-ButtonRelease-5> {$canv xview scroll [scrollval -1] units} +} + proc makewindow {} { global canv canv2 canv3 linespc charspc ctext cflist cscroll global tabstop @@ -2279,9 +2326,8 @@ proc makewindow {} { global headctxmenu progresscanv progressitem progresscoords statusw global fprogitem fprogcoord lastprogupdate progupdatepending global rprogitem rprogcoord rownumsel numcommits - global have_tk85 have_tk86 use_ttk NS - global git_version global worddiff + global hashlength scroll_D0 # The "mc" arguments here are purely so that xgettext # sees the following string as needing to be translated @@ -2333,13 +2379,11 @@ proc makewindow {} { makemenu .bar $bar . configure -menu .bar - if {$use_ttk} { - # cover the non-themed toplevel with a themed frame. - place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1 - } + # cover the non-themed toplevel with a themed frame. + place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1 # the gui has upper and lower half, parts of a paned window. - ${NS}::panedwindow .ctop -orient vertical + ttk::panedwindow .ctop -orient vertical # possibly use assumed geometry if {![info exists geometry(pwsash0)]} { @@ -2352,12 +2396,9 @@ proc makewindow {} { } # the upper half will have a paned window, a scroll bar to the right, and some stuff below - ${NS}::frame .tf -height $geometry(topheight) -width $geometry(topwidth) - ${NS}::frame .tf.histframe - ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal - if {!$use_ttk} { - .tf.histframe.pwclist configure -sashpad 0 -handlesize 4 - } + ttk::frame .tf -height $geometry(topheight) -width $geometry(topwidth) + ttk::frame .tf.histframe + ttk::panedwindow .tf.histframe.pwclist -orient horizontal # create three canvases set cscroll .tf.histframe.csb @@ -2365,6 +2406,7 @@ proc makewindow {} { canvas $canv \ -selectbackground $selectbgcolor \ -background $bgcolor -bd 0 \ + -xscrollincr $linespc \ -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll" .tf.histframe.pwclist add $canv set canv2 .tf.histframe.pwclist.canv2 @@ -2377,28 +2419,22 @@ proc makewindow {} { -selectbackground $selectbgcolor \ -background $bgcolor -bd 0 -yscrollincr $linespc .tf.histframe.pwclist add $canv3 - if {$use_ttk} { - bind .tf.histframe.pwclist <Map> { - bind %W <Map> {} - .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0] - .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0] - } - } else { - eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0) - eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1) + bind .tf.histframe.pwclist <Map> { + bind %W <Map> {} + .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0] + .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0] } # a scroll bar to rule them - ${NS}::scrollbar $cscroll -command {allcanvs yview} - if {!$use_ttk} {$cscroll configure -highlightthickness 0} + ttk::scrollbar $cscroll -command {allcanvs yview} pack $cscroll -side right -fill y bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w} lappend bglist $canv $canv2 $canv3 pack .tf.histframe.pwclist -fill both -expand 1 -side left # we have two button bars at bottom of top frame. Bar 1 - ${NS}::frame .tf.bar - ${NS}::frame .tf.lbar -height 15 + ttk::frame .tf.bar + ttk::frame .tf.lbar -height 15 set sha1entry .tf.bar.sha1 set entries $sha1entry @@ -2407,7 +2443,7 @@ proc makewindow {} { -command gotocommit -width 8 $sha1but conf -disabledforeground [$sha1but cget -foreground] pack .tf.bar.sha1label -side left - ${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string + ttk::entry $sha1entry -width $hashlength -font textfont -textvariable sha1string trace add variable sha1string write sha1change pack $sha1entry -side left -pady 2 @@ -2432,50 +2468,30 @@ proc makewindow {} { image create bitmap bm-right -data $bm_right_data -foreground $uifgcolor image create bitmap bm-right-gray -data $bm_right_data -foreground $uifgdisabledcolor - ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26 - if {$use_ttk} { - .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray] - } else { - .tf.bar.leftbut configure -image bm-left - } + ttk::button .tf.bar.leftbut -command goback -state disabled -width 26 + .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray] pack .tf.bar.leftbut -side left -fill y - ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26 - if {$use_ttk} { - .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray] - } else { - .tf.bar.rightbut configure -image bm-right - } + ttk::button .tf.bar.rightbut -command goforw -state disabled -width 26 + .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray] pack .tf.bar.rightbut -side left -fill y - ${NS}::label .tf.bar.rowlabel -text [mc "Row"] + ttk::label .tf.bar.rowlabel -text [mc "Row"] set rownumsel {} - ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \ + ttk::label .tf.bar.rownum -width 7 -textvariable rownumsel \ -relief sunken -anchor e - ${NS}::label .tf.bar.rowlabel2 -text "/" - ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \ + ttk::label .tf.bar.rowlabel2 -text "/" + ttk::label .tf.bar.numcommits -width 7 -textvariable numcommits \ -relief sunken -anchor e pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \ -side left - if {!$use_ttk} { - foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont} - } global selectedline trace add variable selectedline write selectedline_change # Status label and progress bar set statusw .tf.bar.status - ${NS}::label $statusw -width 15 -relief sunken + ttk::label $statusw -width 15 -relief sunken pack $statusw -side left -padx 5 - if {$use_ttk} { - set progresscanv [ttk::progressbar .tf.bar.progress] - } else { - set h [expr {[font metrics uifont -linespace] + 2}] - set progresscanv .tf.bar.progress - canvas $progresscanv -relief sunken -height $h -borderwidth 2 - set progressitem [$progresscanv create rect -1 0 0 $h -fill "#00ff00"] - set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow] - set rprogitem [$progresscanv create rect -1 0 0 $h -fill red] - } + set progresscanv [ttk::progressbar .tf.bar.progress] pack $progresscanv -side right -expand 1 -fill x -padx {0 2} set progresscoords {0 0} set fprogcoord 0 @@ -2485,7 +2501,7 @@ proc makewindow {} { set progupdatepending 0 # build up the bottom bar of upper window - ${NS}::label .tf.lbar.flabel -text "[mc "Find"] " + ttk::label .tf.lbar.flabel -text "[mc "Find"] " set bm_down_data { #define down_width 16 @@ -2497,7 +2513,7 @@ proc makewindow {} { 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}; } image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor - ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1} + ttk::button .tf.lbar.fnext -width 26 -command {dofind 1 1} .tf.lbar.fnext configure -image bm-down set bm_up_data { @@ -2510,10 +2526,10 @@ proc makewindow {} { 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01}; } image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor - ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1} + ttk::button .tf.lbar.fprev -width 26 -command {dofind -1 1} .tf.lbar.fprev configure -image bm-up - ${NS}::label .tf.lbar.flab2 -text " [mc "commit"] " + ttk::label .tf.lbar.flab2 -text " [mc "commit"] " pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \ -side left -fill y @@ -2529,7 +2545,7 @@ proc makewindow {} { set findstring {} set fstring .tf.lbar.findstring lappend entries $fstring - ${NS}::entry $fstring -width 30 -textvariable findstring + ttk::entry $fstring -width 30 -textvariable findstring trace add variable findstring write find_change set findtype [mc "Exact"] set findtypemenu [makedroplist .tf.lbar.findtype \ @@ -2548,45 +2564,41 @@ proc makewindow {} { pack .tf.bar -in .tf -side bottom -fill x pack .tf.histframe -fill both -side top -expand 1 .ctop add .tf - if {!$use_ttk} { - .ctop paneconfigure .tf -height $geometry(topheight) - .ctop paneconfigure .tf -width $geometry(topwidth) - } # now build up the bottom - ${NS}::panedwindow .pwbottom -orient horizontal + ttk::panedwindow .pwbottom -orient horizontal # lower left, a text box over search bar, scroll bar to the right # if we know window height, then that will set the lower text height, otherwise # we set lower text height which will drive window height if {[info exists geometry(main)]} { - ${NS}::frame .bleft -width $geometry(botwidth) + ttk::frame .bleft -width $geometry(botwidth) } else { - ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight) + ttk::frame .bleft -width $geometry(botwidth) -height $geometry(botheight) } - ${NS}::frame .bleft.top - ${NS}::frame .bleft.mid - ${NS}::frame .bleft.bottom + ttk::frame .bleft.top + ttk::frame .bleft.mid + ttk::frame .bleft.bottom # gap between sub-widgets set wgap [font measure uifont "i"] - ${NS}::button .bleft.top.search -text [mc "Search"] -command dosearch + ttk::button .bleft.top.search -text [mc "Search"] -command dosearch pack .bleft.top.search -side left -padx 5 set sstring .bleft.top.sstring set searchstring "" - ${NS}::entry $sstring -width 20 -textvariable searchstring + ttk::entry $sstring -width 20 -textvariable searchstring lappend entries $sstring trace add variable searchstring write incrsearch pack $sstring -side left -expand 1 -fill x - ${NS}::radiobutton .bleft.mid.diff -text [mc "Diff"] \ + ttk::radiobutton .bleft.mid.diff -text [mc "Diff"] \ -command changediffdisp -variable diffelide -value {0 0} - ${NS}::radiobutton .bleft.mid.old -text [mc "Old version"] \ + ttk::radiobutton .bleft.mid.old -text [mc "Old version"] \ -command changediffdisp -variable diffelide -value {0 1} - ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \ + ttk::radiobutton .bleft.mid.new -text [mc "New version"] \ -command changediffdisp -variable diffelide -value {1 0} - ${NS}::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " + ttk::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap spinbox .bleft.mid.diffcontext -width 5 \ -from 0 -increment 1 -to 10000000 \ @@ -2596,28 +2608,24 @@ proc makewindow {} { trace add variable diffcontextstring write diffcontextchange lappend entries .bleft.mid.diffcontext pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap - ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ + ttk::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ -command changeignorespace -variable ignorespace pack .bleft.mid.ignspace -side left -padx 5 set worddiff [mc "Line diff"] - if {[package vcompare $git_version "1.7.2"] >= 0} { - makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \ - [mc "Markup words"] [mc "Color words"] - trace add variable worddiff write changeworddiff - pack .bleft.mid.worddiff -side left -padx 5 - } + makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \ + [mc "Markup words"] [mc "Color words"] + trace add variable worddiff write changeworddiff + pack .bleft.mid.worddiff -side left -padx 5 set ctext .bleft.bottom.ctext text $ctext -background $bgcolor -foreground $fgcolor \ -state disabled -undo 0 -font textfont \ -yscrollcommand scrolltext -wrap $wrapdefault \ -xscrollcommand ".bleft.bottom.sbhorizontal set" - if {$have_tk85} { - $ctext conf -tabstyle wordprocessor - } - ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview" - ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h + $ctext conf -tabstyle wordprocessor + ttk::scrollbar .bleft.bottom.sb -command "$ctext yview" + ttk::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h pack .bleft.top -side top -fill x pack .bleft.mid -side top -fill x grid $ctext .bleft.bottom.sb -sticky nsew @@ -2668,16 +2676,13 @@ proc makewindow {} { $ctext tag lower d0 .pwbottom add .bleft - if {!$use_ttk} { - .pwbottom paneconfigure .bleft -width $geometry(botwidth) - } # lower right - ${NS}::frame .bright - ${NS}::frame .bright.mode - ${NS}::radiobutton .bright.mode.patch -text [mc "Patch"] \ + ttk::frame .bright + ttk::frame .bright.mode + ttk::radiobutton .bright.mode.patch -text [mc "Patch"] \ -command reselectline -variable cmitmode -value "patch" - ${NS}::radiobutton .bright.mode.tree -text [mc "Tree"] \ + ttk::radiobutton .bright.mode.tree -text [mc "Tree"] \ -command reselectline -variable cmitmode -value "tree" grid .bright.mode.patch .bright.mode.tree -sticky ew pack .bright.mode -side top -fill x @@ -2693,7 +2698,7 @@ proc makewindow {} { -spacing1 1 -spacing3 1 lappend bglist $cflist lappend fglist $cflist - ${NS}::scrollbar .bright.sb -command "$cflist yview" + ttk::scrollbar .bright.sb -command "$cflist yview" pack .bright.sb -side right -fill y pack $cflist -side left -fill both -expand 1 $cflist tag configure highlight \ @@ -2728,44 +2733,31 @@ proc makewindow {} { set ::BM "2" } - if {$use_ttk} { - bind .ctop <Map> { - bind %W <Map> {} - %W sashpos 0 $::geometry(topheight) - } - bind .pwbottom <Map> { - bind %W <Map> {} - %W sashpos 0 $::geometry(botwidth) - } - bind .pwbottom <Configure> {resizecdetpanes %W %w} + bind .ctop <Map> { + bind %W <Map> {} + %W sashpos 0 $::geometry(topheight) + } + bind .pwbottom <Map> { + bind %W <Map> {} + %W sashpos 0 $::geometry(botwidth) } + bind .pwbottom <Configure> {resizecdetpanes %W %w} pack .ctop -fill both -expand 1 bindall <1> {selcanvline %W %x %y} - #bindall <B1-Motion> {selcanvline %W %x %y} + + #Mouse / touchpad scrolling if {[tk windowingsystem] == "win32"} { - bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D } - bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break } + set scroll_D0 120 + bind_mousewheel + } elseif {[tk windowingsystem] == "x11"} { + set scroll_D0 1 + bind_mousewheel_buttons + } elseif {[tk windowingsystem] == "aqua"} { + set scroll_D0 1 + bind_mousewheel } else { - bindall <ButtonRelease-4> "allcanvs yview scroll -5 units" - bindall <ButtonRelease-5> "allcanvs yview scroll 5 units" - bind $ctext <Button> { - if {"%b" eq 6} { - $ctext xview scroll -5 units - } elseif {"%b" eq 7} { - $ctext xview scroll 5 units - } - } - if {[tk windowingsystem] eq "aqua"} { - bindall <MouseWheel> { - set delta [expr {- (%D)}] - allcanvs yview scroll $delta units - } - bindall <Shift-MouseWheel> { - set delta [expr {- (%D)}] - $canv xview scroll $delta units - } - } + puts stderr [mc "Unknown windowing system, cannot bind mouse"] } bindall <$::BM> "canvscan mark %W %x %y" bindall <B$::BM-Motion> "canvscan dragto %W %x %y" @@ -2777,13 +2769,8 @@ proc makewindow {} { bind . <Key-Down> "selnextline 1" bind . <Shift-Key-Up> "dofind -1 0" bind . <Shift-Key-Down> "dofind 1 0" - if {$have_tk86} { - bindkey <<NextChar>> "goforw" - bindkey <<PrevChar>> "goback" - } else { - bindkey <Key-Right> "goforw" - bindkey <Key-Left> "goback" - } + bindkey <<NextChar>> "goforw" + bindkey <<PrevChar>> "goback" bind . <Key-Prior> "selnextpage -1" bind . <Key-Next> "selnextpage 1" bind . <$M1B-Home> "allcanvs yview moveto 0.0" @@ -2910,24 +2897,6 @@ proc makewindow {} { $diff_menu configure -tearoff 0 } -# Windows sends all mouse wheel events to the current focused window, not -# the one where the mouse hovers, so bind those events here and redirect -# to the correct window -proc windows_mousewheel_redirector {W X Y D} { - global canv canv2 canv3 - set w [winfo containing -displayof $W $X $Y] - if {$w ne ""} { - set u [expr {$D < 0 ? 5 : -5}] - if {$w == $canv || $w == $canv2 || $w == $canv3} { - allcanvs yview scroll $u units - } else { - catch { - $w yview scroll $u units - } - } - } -} - # Update row number label when selectedline changes proc selectedline_change {n1 n2 op} { global selectedline rownumsel @@ -2990,30 +2959,10 @@ proc click {w} { # Adjust the progress bar for a change in requested extent or canvas size proc adjustprogress {} { - global progresscanv progressitem progresscoords - global fprogitem fprogcoord lastprogupdate progupdatepending - global rprogitem rprogcoord use_ttk - - if {$use_ttk} { - $progresscanv configure -value [expr {int($fprogcoord * 100)}] - return - } + global progresscanv + global fprogcoord - set w [expr {[winfo width $progresscanv] - 4}] - set x0 [expr {$w * [lindex $progresscoords 0]}] - set x1 [expr {$w * [lindex $progresscoords 1]}] - set h [winfo height $progresscanv] - $progresscanv coords $progressitem $x0 0 $x1 $h - $progresscanv coords $fprogitem 0 0 [expr {$w * $fprogcoord}] $h - $progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h - set now [clock clicks -milliseconds] - if {$now >= $lastprogupdate + 100} { - set progupdatepending 0 - update - } elseif {!$progupdatepending} { - set progupdatepending 1 - after [expr {$lastprogupdate + 100 - $now}] doprogupdate - } + $progresscanv configure -value [expr {int($fprogcoord * 100)}] } proc doprogupdate {} { @@ -3072,7 +3021,6 @@ proc savestuff {w} { upvar #0 viewargscmd current_viewargscmd upvar #0 viewperm current_viewperm upvar #0 nextviewnum current_nextviewnum - upvar #0 use_ttk current_use_ttk if {$stuffsaved} return if {![winfo viewable .]} return @@ -3106,13 +3054,8 @@ proc savestuff {w} { puts $f "set geometry(state) [wm state .]" puts $f "set geometry(topwidth) [winfo width .tf]" puts $f "set geometry(topheight) [winfo height .tf]" - if {$current_use_ttk} { - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" - } else { - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\"" - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\"" - } + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" puts $f "set geometry(botwidth) [winfo width .bleft]" puts $f "set geometry(botheight) [winfo height .bleft]" @@ -3158,17 +3101,14 @@ proc savestuff {w} { } proc resizeclistpanes {win w} { - global oldwidth oldsash use_ttk + global oldwidth oldsash if {[info exists oldwidth($win)]} { if {[info exists oldsash($win)]} { set s0 [lindex $oldsash($win) 0] set s1 [lindex $oldsash($win) 1] - } elseif {$use_ttk} { + } else { set s0 [$win sashpos 0] set s1 [$win sashpos 1] - } else { - set s0 [$win sash coord 0] - set s1 [$win sash coord 1] } if {$w < 60} { set sash0 [expr {int($w/2 - 2)}] @@ -3190,29 +3130,20 @@ proc resizeclistpanes {win w} { } } } - if {$use_ttk} { - $win sashpos 0 $sash0 - $win sashpos 1 $sash1 - } else { - $win sash place 0 $sash0 [lindex $s0 1] - $win sash place 1 $sash1 [lindex $s1 1] - set sash0 [list $sash0 [lindex $s0 1]] - set sash1 [list $sash1 [lindex $s1 1]] - } + $win sashpos 0 $sash0 + $win sashpos 1 $sash1 set oldsash($win) [list $sash0 $sash1] } set oldwidth($win) $w } proc resizecdetpanes {win w} { - global oldwidth oldsash use_ttk + global oldwidth oldsash if {[info exists oldwidth($win)]} { if {[info exists oldsash($win)]} { set s0 $oldsash($win) - } elseif {$use_ttk} { - set s0 [$win sashpos 0] } else { - set s0 [$win sash coord 0] + set s0 [$win sashpos 0] } if {$w < 60} { set sash0 [expr {int($w*3/4 - 2)}] @@ -3226,12 +3157,7 @@ proc resizecdetpanes {win w} { set sash0 [expr {$w - 15}] } } - if {$use_ttk} { - $win sashpos 0 $sash0 - } else { - $win sash place 0 $sash0 [lindex $s0 1] - set sash0 [list $sash0 [lindex $s0 1]] - } + $win sashpos 0 $sash0 set oldsash($win) $sash0 } set oldwidth($win) $w @@ -3252,7 +3178,7 @@ proc bindall {event action} { } proc about {} { - global bgcolor NS + global bgcolor set w .about if {[winfo exists $w]} { raise $w @@ -3269,7 +3195,7 @@ Copyright \u00a9 2005-2016 Paul Mackerras Use and redistribute under the terms of the GNU General Public License"] \ -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove pack $w.m -side top -fill x -padx 2 -pady 2 - ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active + ttk::button $w.ok -text [mc "Close"] -command "destroy $w" -default active pack $w.ok -side bottom bind $w <Visibility> "focus $w.ok" bind $w <Key-Escape> "destroy $w" @@ -3278,7 +3204,7 @@ Use and redistribute under the terms of the GNU General Public License"] \ } proc keys {} { - global bgcolor NS + global bgcolor set w .keys if {[winfo exists $w]} { raise $w @@ -3336,7 +3262,7 @@ proc keys {} { " \ -justify left -bg $bgcolor -border 2 -relief groove pack $w.m -side top -fill both -padx 2 -pady 2 - ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active + ttk::button $w.ok -text [mc "Close"] -command "destroy $w" -default active bind $w <Key-Escape> [list destroy $w] pack $w.ok -side bottom bind $w <Visibility> "focus $w.ok" @@ -4132,6 +4058,7 @@ proc stopblaming {} { proc read_line_source {fd inst} { global blamestuff curview commfd blameinst nullid nullid2 + global hashlength while {[gets $fd line] >= 0} { lappend blamestuff($inst) $line @@ -4152,7 +4079,7 @@ proc read_line_source {fd inst} { set line [split [lindex $blamestuff($inst) 0] " "] set id [lindex $line 0] set lnum [lindex $line 1] - if {[string length $id] == 40 && [string is xdigit $id] && + if {[string length $id] == $hashlength && [string is xdigit $id] && [string is digit -strict $lnum]} { # look for "filename" line foreach l $blamestuff($inst) { @@ -4480,16 +4407,16 @@ proc editview {} { proc vieweditor {top n title} { global newviewname newviewopts viewfiles bgcolor - global known_view_options NS + global known_view_options ttk_toplevel $top wm title $top [concat $title [mc "-- criteria for selecting revisions"]] make_transient $top . # View name - ${NS}::frame $top.nfr - ${NS}::label $top.nl -text [mc "View Name"] - ${NS}::entry $top.name -width 20 -textvariable newviewname($n) + ttk::frame $top.nfr + ttk::label $top.nl -text [mc "View Name"] + ttk::entry $top.name -width 20 -textvariable newviewname($n) pack $top.nfr -in $top -fill x -pady 5 -padx 3 pack $top.nl -in $top.nfr -side left -padx {0 5} pack $top.name -in $top.nfr -side left -padx {0 25} @@ -4508,13 +4435,13 @@ proc vieweditor {top n title} { if {$flags eq "+" || $flags eq "*"} { set cframe $top.fr$cnt incr cnt - ${NS}::frame $cframe + ttk::frame $cframe pack $cframe -in $top -fill x -pady 3 -padx 3 set cexpand [expr {$flags eq "*"}] } elseif {$flags eq ".." || $flags eq "*."} { set cframe $top.fr$cnt incr cnt - ${NS}::frame $cframe + ttk::frame $cframe pack $cframe -in $top -fill x -pady 3 -padx [list 15 3] set cexpand [expr {$flags eq "*."}] } else { @@ -4522,31 +4449,31 @@ proc vieweditor {top n title} { } if {$type eq "l"} { - ${NS}::label $cframe.l_$id -text $title + ttk::label $cframe.l_$id -text $title pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w } elseif {$type eq "b"} { - ${NS}::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id) + ttk::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id) pack $cframe.c_$id -in $cframe -side left \ -padx [list $lxpad 0] -expand $cexpand -anchor w } elseif {[regexp {^r(\d+)$} $type type sz]} { regexp {^(.*_)} $id uselessvar button_id - ${NS}::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz + ttk::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz pack $cframe.c_$id -in $cframe -side left \ -padx [list $lxpad 0] -expand $cexpand -anchor w } elseif {[regexp {^t(\d+)$} $type type sz]} { - ${NS}::label $cframe.l_$id -text $title - ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \ + ttk::label $cframe.l_$id -text $title + ttk::entry $cframe.e_$id -width $sz -background $bgcolor \ -textvariable newviewopts($n,$id) pack $cframe.l_$id -in $cframe -side left -padx [list $lxpad 0] pack $cframe.e_$id -in $cframe -side left -expand 1 -fill x } elseif {[regexp {^t(\d+)=$} $type type sz]} { - ${NS}::label $cframe.l_$id -text $title - ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \ + ttk::label $cframe.l_$id -text $title + ttk::entry $cframe.e_$id -width $sz -background $bgcolor \ -textvariable newviewopts($n,$id) pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w pack $cframe.e_$id -in $cframe -side top -fill x } elseif {$type eq "path"} { - ${NS}::label $top.l -text $title + ttk::label $top.l -text $title pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3 text $top.t -width 40 -height 5 -background $bgcolor if {[info exists viewfiles($n)]} { @@ -4561,10 +4488,10 @@ proc vieweditor {top n title} { } } - ${NS}::frame $top.buts - ${NS}::button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] - ${NS}::button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1] - ${NS}::button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] + ttk::frame $top.buts + ttk::button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] + ttk::button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1] + ttk::button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] bind $top <Control-Return> [list newviewok $top $n] bind $top <F5> [list newviewok $top $n 1] bind $top <Escape> [list destroy $top] @@ -5296,11 +5223,13 @@ proc askrelhighlight {row id} { # Graph layout functions proc shortids {ids} { + global hashlength + set res {} foreach id $ids { if {[llength $id] > 1} { lappend res [shortids $id] - } elseif {[regexp {^[0-9a-f]{40}$} $id]} { + } elseif {[regexp [string map "@@ $hashlength" {^[0-9a-f]{@@}$}] $id]} { lappend res [string range $id 0 7] } else { lappend res $id @@ -5475,13 +5404,14 @@ proc get_viewmainhead {view} { # git rev-list should give us just 1 line to use as viewmainheadid($view) proc getviewhead {fd inst view} { global viewmainheadid commfd curview viewinstances showlocalchanges + global hashlength set id {} if {[gets $fd line] < 0} { if {![eof $fd]} { return 1 } - } elseif {[string length $line] == 40 && [string is xdigit $line]} { + } elseif {[string length $line] == $hashlength && [string is xdigit $line]} { set id $line } set viewmainheadid($view) $id @@ -5523,15 +5453,11 @@ proc dohidelocalchanges {} { # spawn off a process to do git diff-index --cached HEAD proc dodiffindex {} { global lserial showlocalchanges vfilelimit curview - global hasworktree git_version + global hasworktree if {!$showlocalchanges || !$hasworktree} return incr lserial - if {[package vcompare $git_version "1.7.2"] >= 0} { - set cmd "git diff-index --cached --ignore-submodules=dirty HEAD" - } else { - set cmd "git diff-index --cached HEAD" - } + set cmd "git diff-index --cached --ignore-submodules=dirty HEAD" if {$vfilelimit($curview) ne {}} { set cmd [concat $cmd -- $vfilelimit($curview)] } @@ -6759,13 +6685,7 @@ proc bindline {t id} { } proc graph_pane_width {} { - global use_ttk - - if {$use_ttk} { - set g [.tf.histframe.pwclist sashpos 0] - } else { - set g [.tf.histframe.pwclist sash coord 0] - } + set g [.tf.histframe.pwclist sashpos 0] return [lindex $g 0] } @@ -7245,10 +7165,11 @@ proc commit_descriptor {p} { # Also look for URLs of the form "http[s]://..." and make them web links. proc appendwithlinks {text tags} { global ctext linknum curview + global hashlength set start [$ctext index "end - 1c"] $ctext insert end $text $tags - set links [regexp -indices -all -inline {(?:\m|-g)[0-9a-f]{6,40}\M} $text] + set links [regexp -indices -all -inline [string map "@@ $hashlength" {(?:\m|-g)[0-9a-f]{6,@@}\M}] $text] foreach l $links { set s [lindex $l 0] set e [lindex $l 1] @@ -7276,13 +7197,14 @@ proc appendwithlinks {text tags} { proc setlink {id lk} { global curview ctext pendinglinks global linkfgcolor + global hashlength if {[string range $id 0 1] eq "-g"} { set id [string range $id 2 end] } set known 0 - if {[string length $id] < 40} { + if {[string length $id] < $hashlength} { set matches [longid $id] if {[llength $matches] > 0} { if {[llength $matches] > 1} return @@ -8079,7 +8001,7 @@ proc addtocflist {ids} { } proc diffcmd {ids flags} { - global log_showroot nullid nullid2 git_version + global log_showroot nullid nullid2 set i [lsearch -exact $ids $nullid] set j [lsearch -exact $ids $nullid2] @@ -8100,9 +8022,7 @@ proc diffcmd {ids flags} { } } } elseif {$j >= 0} { - if {[package vcompare $git_version "1.7.2"] >= 0} { - set flags "$flags --ignore-submodules=dirty" - } + set flags "$flags --ignore-submodules=dirty" set cmd [concat git diff-index --cached $flags] if {[llength $ids] > 1} { # comparing index with specific revision @@ -8231,17 +8151,8 @@ proc getblobdiffs {ids} { global ignorespace global worddiff global limitdiffs vfilelimit curview - global git_version - set textconv {} - if {[package vcompare $git_version "1.6.1"] >= 0} { - set textconv "--textconv" - } - set submodule {} - if {[package vcompare $git_version "1.6.6"] >= 0} { - set submodule "--submodule" - } - set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"] + set cmd [diffcmd $ids "-p --textconv --submodule -C --cc --no-commit-id -U$diffcontext"] if {$ignorespace} { append cmd " -w" } @@ -8646,19 +8557,17 @@ proc clear_ctext {{first 1.0}} { } proc settabs {{firstab {}}} { - global firsttabstop tabstop ctext have_tk85 + global firsttabstop tabstop ctext - if {$firstab ne {} && $have_tk85} { + if {$firstab ne {}} { set firsttabstop $firstab } set w [font measure textfont "0"] if {$firsttabstop != 0} { $ctext conf -tabs [list [expr {($firsttabstop + $tabstop) * $w}] \ [expr {($firsttabstop + 2 * $tabstop) * $w}]] - } elseif {$have_tk85 || $tabstop != 8} { - $ctext conf -tabs [expr {$tabstop * $w}] } else { - $ctext conf -tabs {} + $ctext conf -tabs [expr {$tabstop * $w}] } } @@ -8927,13 +8836,16 @@ proc incrfont {inc} { proc clearsha1 {} { global sha1entry sha1string - if {[string length $sha1string] == 40} { + global hashlength + + if {[string length $sha1string] == $hashlength} { $sha1entry delete 0 end } } proc sha1change {n1 n2 op} { global sha1string currentid sha1but + if {$sha1string == {} || ([info exists currentid] && $sha1string == $currentid)} { set state disabled @@ -8950,6 +8862,7 @@ proc sha1change {n1 n2 op} { proc gotocommit {} { global sha1string tagids headids curview varcid + global hashlength if {$sha1string == {} || ([info exists currentid] && $sha1string == $currentid)} return @@ -8959,7 +8872,7 @@ proc gotocommit {} { set id $headids($sha1string) } else { set id [string tolower $sha1string] - if {[regexp {^[0-9a-f]{4,39}$} $id]} { + if {[regexp {^[0-9a-f]{4,63}$} $id]} { set matches [longid $id] if {$matches ne {}} { if {[llength $matches] > 1} { @@ -9445,7 +9358,8 @@ proc doseldiff {oldid newid} { } proc mkpatch {} { - global rowmenuid currentid commitinfo patchtop patchnum NS + global rowmenuid currentid commitinfo patchtop patchnum + global hashlength if {![info exists currentid]} return set oldid $currentid @@ -9457,36 +9371,36 @@ proc mkpatch {} { catch {destroy $top} ttk_toplevel $top make_transient $top . - ${NS}::label $top.title -text [mc "Generate patch"] + ttk::label $top.title -text [mc "Generate patch"] grid $top.title - -pady 10 - ${NS}::label $top.from -text [mc "From:"] - ${NS}::entry $top.fromsha1 -width 40 + ttk::label $top.from -text [mc "From:"] + ttk::entry $top.fromsha1 -width $hashlength $top.fromsha1 insert 0 $oldid $top.fromsha1 conf -state readonly grid $top.from $top.fromsha1 -sticky w - ${NS}::entry $top.fromhead -width 60 + ttk::entry $top.fromhead -width 60 $top.fromhead insert 0 $oldhead $top.fromhead conf -state readonly grid x $top.fromhead -sticky w - ${NS}::label $top.to -text [mc "To:"] - ${NS}::entry $top.tosha1 -width 40 + ttk::label $top.to -text [mc "To:"] + ttk::entry $top.tosha1 -width $hashlength $top.tosha1 insert 0 $newid $top.tosha1 conf -state readonly grid $top.to $top.tosha1 -sticky w - ${NS}::entry $top.tohead -width 60 + ttk::entry $top.tohead -width 60 $top.tohead insert 0 $newhead $top.tohead conf -state readonly grid x $top.tohead -sticky w - ${NS}::button $top.rev -text [mc "Reverse"] -command mkpatchrev + ttk::button $top.rev -text [mc "Reverse"] -command mkpatchrev grid $top.rev x -pady 10 -padx 5 - ${NS}::label $top.flab -text [mc "Output file:"] - ${NS}::entry $top.fname -width 60 + ttk::label $top.flab -text [mc "Output file:"] + ttk::entry $top.fname -width 60 $top.fname insert 0 [file normalize "patch$patchnum.patch"] incr patchnum grid $top.flab $top.fname -sticky w - ${NS}::frame $top.buts - ${NS}::button $top.buts.gen -text [mc "Generate"] -command mkpatchgo - ${NS}::button $top.buts.can -text [mc "Cancel"] -command mkpatchcan + ttk::frame $top.buts + ttk::button $top.buts.gen -text [mc "Generate"] -command mkpatchgo + ttk::button $top.buts.can -text [mc "Cancel"] -command mkpatchcan bind $top <Key-Return> mkpatchgo bind $top <Key-Escape> mkpatchcan grid $top.buts.gen $top.buts.can @@ -9534,35 +9448,36 @@ proc mkpatchcan {} { } proc mktag {} { - global rowmenuid mktagtop commitinfo NS + global rowmenuid mktagtop commitinfo + global hashlength set top .maketag set mktagtop $top catch {destroy $top} ttk_toplevel $top make_transient $top . - ${NS}::label $top.title -text [mc "Create tag"] + ttk::label $top.title -text [mc "Create tag"] grid $top.title - -pady 10 - ${NS}::label $top.id -text [mc "ID:"] - ${NS}::entry $top.sha1 -width 40 + ttk::label $top.id -text [mc "ID:"] + ttk::entry $top.sha1 -width $hashlength $top.sha1 insert 0 $rowmenuid $top.sha1 conf -state readonly grid $top.id $top.sha1 -sticky w - ${NS}::entry $top.head -width 60 + ttk::entry $top.head -width 60 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] $top.head conf -state readonly grid x $top.head -sticky w - ${NS}::label $top.tlab -text [mc "Tag name:"] - ${NS}::entry $top.tag -width 60 + ttk::label $top.tlab -text [mc "Tag name:"] + ttk::entry $top.tag -width 60 grid $top.tlab $top.tag -sticky w - ${NS}::label $top.op -text [mc "Tag message is optional"] + ttk::label $top.op -text [mc "Tag message is optional"] grid $top.op -columnspan 2 -sticky we - ${NS}::label $top.mlab -text [mc "Tag message:"] - ${NS}::entry $top.msg -width 60 + ttk::label $top.mlab -text [mc "Tag message:"] + ttk::entry $top.msg -width 60 grid $top.mlab $top.msg -sticky w - ${NS}::frame $top.buts - ${NS}::button $top.buts.gen -text [mc "Create"] -command mktaggo - ${NS}::button $top.buts.can -text [mc "Cancel"] -command mktagcan + ttk::frame $top.buts + ttk::button $top.buts.gen -text [mc "Create"] -command mktaggo + ttk::button $top.buts.can -text [mc "Cancel"] -command mktagcan bind $top <Key-Return> mktaggo bind $top <Key-Escape> mktagcan grid $top.buts.gen $top.buts.can @@ -9652,10 +9567,11 @@ proc mktaggo {} { proc copyreference {} { global rowmenuid autosellen + global hashlength set format "%h (\"%s\", %ad)" set cmd [list git show -s --pretty=format:$format --date=short] - if {$autosellen < 40} { + if {$autosellen < $hashlength} { lappend cmd --abbrev=$autosellen } set reference [safe_exec [concat $cmd $rowmenuid]] @@ -9665,34 +9581,35 @@ proc copyreference {} { } proc writecommit {} { - global rowmenuid wrcomtop commitinfo wrcomcmd NS + global rowmenuid wrcomtop commitinfo wrcomcmd + global hashlength set top .writecommit set wrcomtop $top catch {destroy $top} ttk_toplevel $top make_transient $top . - ${NS}::label $top.title -text [mc "Write commit to file"] + ttk::label $top.title -text [mc "Write commit to file"] grid $top.title - -pady 10 - ${NS}::label $top.id -text [mc "ID:"] - ${NS}::entry $top.sha1 -width 40 + ttk::label $top.id -text [mc "ID:"] + ttk::entry $top.sha1 -width $hashlength $top.sha1 insert 0 $rowmenuid $top.sha1 conf -state readonly grid $top.id $top.sha1 -sticky w - ${NS}::entry $top.head -width 60 + ttk::entry $top.head -width 60 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] $top.head conf -state readonly grid x $top.head -sticky w - ${NS}::label $top.clab -text [mc "Command:"] - ${NS}::entry $top.cmd -width 60 -textvariable wrcomcmd + ttk::label $top.clab -text [mc "Command:"] + ttk::entry $top.cmd -width 60 -textvariable wrcomcmd grid $top.clab $top.cmd -sticky w -pady 10 - ${NS}::label $top.flab -text [mc "Output file:"] - ${NS}::entry $top.fname -width 60 + ttk::label $top.flab -text [mc "Output file:"] + ttk::entry $top.fname -width 60 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] grid $top.flab $top.fname -sticky w - ${NS}::frame $top.buts - ${NS}::button $top.buts.gen -text [mc "Write"] -command wrcomgo - ${NS}::button $top.buts.can -text [mc "Cancel"] -command wrcomcan + ttk::frame $top.buts + ttk::button $top.buts.gen -text [mc "Write"] -command wrcomgo + ttk::button $top.buts.can -text [mc "Cancel"] -command wrcomcan bind $top <Key-Return> wrcomgo bind $top <Key-Escape> wrcomcan grid $top.buts.gen $top.buts.can @@ -9723,7 +9640,7 @@ proc wrcomcan {} { } proc mkbranch {} { - global NS rowmenuid + global rowmenuid set top .branchdialog @@ -9738,7 +9655,6 @@ proc mkbranch {} { } proc mvbranch {} { - global NS global headmenuid headmenuhead set top .branchdialog @@ -9754,31 +9670,32 @@ proc mvbranch {} { } proc branchdia {top valvar uivar} { - global NS commitinfo + global commitinfo + global hashlength upvar $valvar val $uivar ui catch {destroy $top} ttk_toplevel $top make_transient $top . - ${NS}::label $top.title -text $ui(title) + ttk::label $top.title -text $ui(title) grid $top.title - -pady 10 - ${NS}::label $top.id -text [mc "ID:"] - ${NS}::entry $top.sha1 -width 40 + ttk::label $top.id -text [mc "ID:"] + ttk::entry $top.sha1 -width $hashlength $top.sha1 insert 0 $val(id) $top.sha1 conf -state readonly grid $top.id $top.sha1 -sticky w - ${NS}::entry $top.head -width 60 + ttk::entry $top.head -width 60 $top.head insert 0 [lindex $commitinfo($val(id)) 0] $top.head conf -state readonly grid x $top.head -sticky ew grid columnconfigure $top 1 -weight 1 - ${NS}::label $top.nlab -text [mc "Name:"] - ${NS}::entry $top.name -width 40 + ttk::label $top.nlab -text [mc "Name:"] + ttk::entry $top.name -width $hashlength $top.name insert 0 $val(name) grid $top.nlab $top.name -sticky w - ${NS}::frame $top.buts - ${NS}::button $top.buts.go -text $ui(accept) -command $val(command) - ${NS}::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}" + ttk::frame $top.buts + ttk::button $top.buts.go -text $ui(accept) -command $val(command) + ttk::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}" bind $top <Key-Return> $val(command) bind $top <Key-Escape> "catch {destroy $top}" grid $top.buts.go $top.buts.can @@ -10025,31 +9942,31 @@ proc revert {} { } proc resethead {} { - global mainhead rowmenuid confirm_ok resettype NS + global mainhead rowmenuid confirm_ok resettype set confirm_ok 0 set w ".confirmreset" ttk_toplevel $w make_transient $w . wm title $w [mc "Confirm reset"] - ${NS}::label $w.m -text \ + ttk::label $w.m -text \ [mc "Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] pack $w.m -side top -fill x -padx 20 -pady 20 - ${NS}::labelframe $w.f -text [mc "Reset type:"] + ttk::labelframe $w.f -text [mc "Reset type:"] set resettype mixed - ${NS}::radiobutton $w.f.soft -value soft -variable resettype \ + ttk::radiobutton $w.f.soft -value soft -variable resettype \ -text [mc "Soft: Leave working tree and index untouched"] grid $w.f.soft -sticky w - ${NS}::radiobutton $w.f.mixed -value mixed -variable resettype \ + ttk::radiobutton $w.f.mixed -value mixed -variable resettype \ -text [mc "Mixed: Leave working tree untouched, reset index"] grid $w.f.mixed -sticky w - ${NS}::radiobutton $w.f.hard -value hard -variable resettype \ + ttk::radiobutton $w.f.hard -value hard -variable resettype \ -text [mc "Hard: Reset working tree and index\n(discard ALL local changes)"] grid $w.f.hard -sticky w pack $w.f -side top -fill x -padx 4 - ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" + ttk::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" pack $w.ok -side left -fill x -padx 20 -pady 20 - ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" + ttk::button $w.cancel -text [mc Cancel] -command "destroy $w" bind $w <Key-Escape> [list destroy $w] pack $w.cancel -side right -fill x -padx 20 -pady 20 bind $w <Visibility> "grab $w; focus $w" @@ -10226,7 +10143,7 @@ proc rmbranch {} { # Display a list of tags and heads proc showrefs {} { - global showrefstop bgcolor fgcolor selectbgcolor NS + global showrefstop bgcolor fgcolor selectbgcolor global bglist fglist reflistfilter reflist maincursor set top .showrefs @@ -10249,19 +10166,22 @@ proc showrefs {} { lappend bglist $top.list lappend fglist $top.list } - ${NS}::scrollbar $top.ysb -command "$top.list yview" -orient vertical - ${NS}::scrollbar $top.xsb -command "$top.list xview" -orient horizontal + ttk::scrollbar $top.ysb -command "$top.list yview" -orient vertical + ttk::scrollbar $top.xsb -command "$top.list xview" -orient horizontal grid $top.list $top.ysb -sticky nsew grid $top.xsb x -sticky ew - ${NS}::frame $top.f - ${NS}::label $top.f.l -text "[mc "Filter"]: " - ${NS}::entry $top.f.e -width 20 -textvariable reflistfilter + ttk::frame $top.f + ttk::label $top.f.l -text "[mc "Filter"]: " + ttk::entry $top.f.e -width 20 -textvariable reflistfilter set reflistfilter "*" trace add variable reflistfilter write reflistfilter_change pack $top.f.e -side right -fill x -expand 1 pack $top.f.l -side left grid $top.f - -sticky ew -pady 2 - ${NS}::button $top.close -command [list destroy $top] -text [mc "Close"] + ttk::checkbutton $top.sort -text [mc "Sort refs by type"] \ + -variable sortrefsbytype -command {refill_reflist} + grid $top.sort - -sticky w -pady 2 + ttk::button $top.close -command [list destroy $top] -text [mc "Close"] bind $top <Key-Escape> [list destroy $top] grid $top.close - grid columnconfigure $top 0 -weight 1 @@ -10304,43 +10224,71 @@ proc reflistfilter_change {n1 n2 op} { } proc refill_reflist {} { - global reflist reflistfilter showrefstop headids tagids otherrefids - global curview + global reflist reflistfilter showrefstop headids tagids otherrefids sortrefsbytype + global curview upstreamofref if {![info exists showrefstop] || ![winfo exists $showrefstop]} return - set refs {} + set localrefs {} + set remoterefs {} + set trackedremoterefs {} + set tagrefs {} + set otherrefs {} + foreach n [array names headids] { - if {[string match $reflistfilter $n]} { + if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} { if {[commitinview $headids($n) $curview]} { - if {[string match "remotes/*" $n]} { - lappend refs [list $n R] - } else { - lappend refs [list $n H] + lappend localrefs [list $n H] + if {[info exists upstreamofref($n)]} { + lappend trackedremoterefs [list $upstreamofref($n) R] + } + } else { + interestedin $headids($n) {run refill_reflist} + } + } + } + set trackedremoterefs [lsort -index 0 $trackedremoterefs] + set localrefs [lsort -index 0 $localrefs] + + foreach n [array names headids] { + if {[string match "remotes/*" $n] && [string match $reflistfilter $n]} { + if {[commitinview $headids($n) $curview]} { + if {[lsearch -exact $trackedremoterefs [list $n R]] < 0} { + lappend remoterefs [list $n R] } } else { interestedin $headids($n) {run refill_reflist} } } } + set remoterefs [lsort -index 0 $remoterefs] + foreach n [array names tagids] { if {[string match $reflistfilter $n]} { if {[commitinview $tagids($n) $curview]} { - lappend refs [list $n T] + lappend tagrefs [list $n T] } else { interestedin $tagids($n) {run refill_reflist} } } } + set tagrefs [lsort -index 0 $tagrefs] + foreach n [array names otherrefids] { if {[string match $reflistfilter $n]} { if {[commitinview $otherrefids($n) $curview]} { - lappend refs [list $n o] + lappend otherrefs [list "$n" o] } else { interestedin $otherrefids($n) {run refill_reflist} } } } - set refs [lsort -index 0 $refs] + set otherrefs [lsort -index 0 $otherrefs] + + set refs [concat $localrefs $trackedremoterefs $remoterefs $tagrefs $otherrefs] + if {!$sortrefsbytype} { + set refs [lsort -index 0 $refs] + } + if {$refs eq $reflist} return # Update the contents of $showrefstop.list according to the @@ -11599,84 +11547,16 @@ proc doquit {} { } proc mkfontdisp {font top which} { - global fontattr fontpref $font NS use_ttk + global fontattr fontpref $font set fontpref($font) [set $font] - ${NS}::button $top.${font}but -text $which \ + ttk::button $top.${font}but -text $which \ -command [list choosefont $font $which] - ${NS}::label $top.$font -relief flat -font $font \ + ttk::label $top.$font -relief flat -font $font \ -text $fontattr($font,family) -justify left grid x $top.${font}but $top.$font -sticky w } -proc choosefont {font which} { - global fontparam fontlist fonttop fontattr - global prefstop NS - - set fontparam(which) $which - set fontparam(font) $font - set fontparam(family) [font actual $font -family] - set fontparam(size) $fontattr($font,size) - set fontparam(weight) $fontattr($font,weight) - set fontparam(slant) $fontattr($font,slant) - set top .gitkfont - set fonttop $top - if {![winfo exists $top]} { - font create sample - eval font config sample [font actual $font] - ttk_toplevel $top - make_transient $top $prefstop - wm title $top [mc "Gitk font chooser"] - ${NS}::label $top.l -textvariable fontparam(which) - pack $top.l -side top - set fontlist [lsort [font families]] - ${NS}::frame $top.f - listbox $top.f.fam -listvariable fontlist \ - -yscrollcommand [list $top.f.sb set] - bind $top.f.fam <<ListboxSelect>> selfontfam - ${NS}::scrollbar $top.f.sb -command [list $top.f.fam yview] - pack $top.f.sb -side right -fill y - pack $top.f.fam -side left -fill both -expand 1 - pack $top.f -side top -fill both -expand 1 - ${NS}::frame $top.g - spinbox $top.g.size -from 4 -to 40 -width 4 \ - -textvariable fontparam(size) \ - -validatecommand {string is integer -strict %s} - checkbutton $top.g.bold -padx 5 \ - -font {{Times New Roman} 12 bold} -text [mc "B"] -indicatoron 0 \ - -variable fontparam(weight) -onvalue bold -offvalue normal - checkbutton $top.g.ital -padx 5 \ - -font {{Times New Roman} 12 italic} -text [mc "I"] -indicatoron 0 \ - -variable fontparam(slant) -onvalue italic -offvalue roman - pack $top.g.size $top.g.bold $top.g.ital -side left - pack $top.g -side top - canvas $top.c -width 150 -height 50 -border 2 -relief sunk \ - -background white - $top.c create text 100 25 -anchor center -text $which -font sample \ - -fill black -tags text - bind $top.c <Configure> [list centertext $top.c] - pack $top.c -side top -fill x - ${NS}::frame $top.buts - ${NS}::button $top.buts.ok -text [mc "OK"] -command fontok -default active - ${NS}::button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal - bind $top <Key-Return> fontok - bind $top <Key-Escape> fontcan - grid $top.buts.ok $top.buts.can - grid columnconfigure $top.buts 0 -weight 1 -uniform a - grid columnconfigure $top.buts 1 -weight 1 -uniform a - pack $top.buts -side bottom -fill x - trace add variable fontparam write chg_fontparam - } else { - raise $top - $top.c itemconf text -text $which - } - set i [lsearch -exact $fontlist $fontparam(family)] - if {$i >= 0} { - $top.f.fam selection set $i - $top.f.fam see $i - } -} - proc centertext {w} { $w coords text [expr {[winfo width $w] / 2}] [expr {[winfo height $w] / 2}] } @@ -11709,26 +11589,21 @@ proc fontcan {} { } } -if {[package vsatisfies [package provide Tk] 8.6]} { - # In Tk 8.6 we have a native font chooser dialog. Overwrite the above - # function to make use of it. - proc choosefont {font which} { - tk fontchooser configure -title $which -font $font \ - -command [list on_choosefont $font $which] - tk fontchooser show - } - proc on_choosefont {font which newfont} { - global fontparam - puts stderr "$font $newfont" - array set f [font actual $newfont] - set fontparam(which) $which - set fontparam(font) $font - set fontparam(family) $f(-family) - set fontparam(size) $f(-size) - set fontparam(weight) $f(-weight) - set fontparam(slant) $f(-slant) - fontok - } +proc choosefont {font which} { + tk fontchooser configure -title $which -font $font \ + -command [list on_choosefont $font $which] + tk fontchooser show +} +proc on_choosefont {font which newfont} { + global fontparam + array set f [font actual $newfont] + set fontparam(which) $which + set fontparam(font) $font + set fontparam(family) $f(-family) + set fontparam(size) $f(-size) + set fontparam(weight) $f(-weight) + set fontparam(slant) $f(-slant) + fontok } proc selfontfam {} { @@ -11748,172 +11623,157 @@ proc chg_fontparam {v sub op} { # Create a property sheet tab page proc create_prefs_page {w} { - global NS - set parent [join [lrange [split $w .] 0 end-1] .] - if {[winfo class $parent] eq "TNotebook"} { - ${NS}::frame $w - } else { - ${NS}::labelframe $w - } + ttk::frame $w } proc prefspage_general {notebook} { - global NS maxwidth maxgraphpct showneartags showlocalchanges - global tabstop wrapcomment wrapdefault limitdiffs - global autocopy autoselect autosellen extdifftool perfile_attrs - global hideremotes want_ttk have_ttk maxrefs web_browser + global {*}$::config_variables + global hashlength set page [create_prefs_page $notebook.general] - ${NS}::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold + ttk::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold grid $page.ldisp - -sticky w -pady 10 - ${NS}::label $page.spacer -text " " - ${NS}::label $page.maxwidthl -text [mc "Maximum graph width (lines)"] + ttk::label $page.spacer -text " " + ttk::label $page.maxwidthl -text [mc "Maximum graph width (lines)"] spinbox $page.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth grid $page.spacer $page.maxwidthl $page.maxwidth -sticky w #xgettext:no-tcl-format - ${NS}::label $page.maxpctl -text [mc "Maximum graph width (% of pane)"] + ttk::label $page.maxpctl -text [mc "Maximum graph width (% of pane)"] spinbox $page.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct grid x $page.maxpctl $page.maxpct -sticky w - ${NS}::checkbutton $page.showlocal -text [mc "Show local changes"] \ + ttk::checkbutton $page.showlocal -text [mc "Show local changes"] \ -variable showlocalchanges grid x $page.showlocal -sticky w - ${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \ + ttk::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \ -variable hideremotes grid x $page.hideremotes -sticky w - ${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ + ttk::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ -variable autocopy grid x $page.autocopy -sticky w if {[haveselectionclipboard]} { - ${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \ + ttk::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \ -variable autoselect grid x $page.autoselect -sticky w } - spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen - ${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"] + + spinbox $page.autosellen -from 1 -to $hashlength -width 4 -textvariable autosellen + ttk::label $page.autosellenl -text [mc "Length of commit ID to copy"] grid x $page.autosellenl $page.autosellen -sticky w + ttk::label $page.kscroll1 -text [mc "Wheel scrolling multiplier"] + spinbox $page.kscroll -from 1 -to 20 -width 4 -textvariable kscroll + grid x $page.kscroll1 $page.kscroll -sticky w - ${NS}::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold + ttk::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold grid $page.ddisp - -sticky w -pady 10 - ${NS}::label $page.tabstopl -text [mc "Tab spacing"] + ttk::label $page.tabstopl -text [mc "Tab spacing"] spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop grid x $page.tabstopl $page.tabstop -sticky w - ${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"] + ttk::label $page.wrapcommentl -text [mc "Wrap comment text"] makedroplist $page.wrapcomment wrapcomment none char word grid x $page.wrapcommentl $page.wrapcomment -sticky w - ${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"] + ttk::label $page.wrapdefaultl -text [mc "Wrap other text"] makedroplist $page.wrapdefault wrapdefault none char word grid x $page.wrapdefaultl $page.wrapdefault -sticky w - ${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \ + ttk::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \ -variable showneartags grid x $page.ntag -sticky w - ${NS}::label $page.maxrefsl -text [mc "Maximum # tags/heads to show"] + ttk::label $page.maxrefsl -text [mc "Maximum # tags/heads to show"] spinbox $page.maxrefs -from 1 -to 1000 -width 4 -textvariable maxrefs grid x $page.maxrefsl $page.maxrefs -sticky w - ${NS}::checkbutton $page.ldiff -text [mc "Limit diffs to listed paths"] \ + ttk::checkbutton $page.ldiff -text [mc "Limit diffs to listed paths"] \ -variable limitdiffs grid x $page.ldiff -sticky w - ${NS}::checkbutton $page.lattr -text [mc "Support per-file encodings"] \ + ttk::checkbutton $page.lattr -text [mc "Support per-file encodings"] \ -variable perfile_attrs grid x $page.lattr -sticky w - ${NS}::entry $page.extdifft -textvariable extdifftool - ${NS}::frame $page.extdifff - ${NS}::label $page.extdifff.l -text [mc "External diff tool" ] - ${NS}::button $page.extdifff.b -text [mc "Choose..."] -command choose_extdiff + ttk::entry $page.extdifft -textvariable extdifftool + ttk::frame $page.extdifff + ttk::label $page.extdifff.l -text [mc "External diff tool" ] + ttk::button $page.extdifff.b -text [mc "Choose..."] -command choose_extdiff pack $page.extdifff.l $page.extdifff.b -side left pack configure $page.extdifff.l -padx 10 grid x $page.extdifff $page.extdifft -sticky ew - ${NS}::entry $page.webbrowser -textvariable web_browser - ${NS}::frame $page.webbrowserf - ${NS}::label $page.webbrowserf.l -text [mc "Web browser" ] + ttk::entry $page.webbrowser -textvariable web_browser + ttk::frame $page.webbrowserf + ttk::label $page.webbrowserf.l -text [mc "Web browser" ] pack $page.webbrowserf.l -side left pack configure $page.webbrowserf.l -padx 10 grid x $page.webbrowserf $page.webbrowser -sticky ew - ${NS}::label $page.lgen -text [mc "General options"] -font mainfontbold - grid $page.lgen - -sticky w -pady 10 - ${NS}::checkbutton $page.want_ttk -variable want_ttk \ - -text [mc "Use themed widgets"] - if {$have_ttk} { - ${NS}::label $page.ttk_note -text [mc "(change requires restart)"] - } else { - ${NS}::label $page.ttk_note -text [mc "(currently unavailable)"] - } - grid x $page.want_ttk $page.ttk_note -sticky w return $page } proc prefspage_colors {notebook} { - global NS uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor + global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor global diffbgcolors set page [create_prefs_page $notebook.colors] - ${NS}::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold + ttk::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold grid $page.cdisp - -sticky w -pady 10 label $page.ui -padx 40 -relief sunk -background $uicolor - ${NS}::button $page.uibut -text [mc "Interface"] \ + ttk::button $page.uibut -text [mc "Interface"] \ -command [list choosecolor uicolor {} $page.ui [mc "interface"] setui] grid x $page.uibut $page.ui -sticky w label $page.bg -padx 40 -relief sunk -background $bgcolor - ${NS}::button $page.bgbut -text [mc "Background"] \ + ttk::button $page.bgbut -text [mc "Background"] \ -command [list choosecolor bgcolor {} $page.bg [mc "background"] setbg] grid x $page.bgbut $page.bg -sticky w label $page.fg -padx 40 -relief sunk -background $fgcolor - ${NS}::button $page.fgbut -text [mc "Foreground"] \ + ttk::button $page.fgbut -text [mc "Foreground"] \ -command [list choosecolor fgcolor {} $page.fg [mc "foreground"] setfg] grid x $page.fgbut $page.fg -sticky w label $page.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0] - ${NS}::button $page.diffoldbut -text [mc "Diff: old lines"] \ + ttk::button $page.diffoldbut -text [mc "Diff: old lines"] \ -command [list choosecolor diffcolors 0 $page.diffold [mc "diff old lines"] \ [list $ctext tag conf d0 -foreground]] grid x $page.diffoldbut $page.diffold -sticky w label $page.diffoldbg -padx 40 -relief sunk -background [lindex $diffbgcolors 0] - ${NS}::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \ + ttk::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \ -command [list choosecolor diffbgcolors 0 $page.diffoldbg \ [mc "diff old lines bg"] \ [list $ctext tag conf d0 -background]] grid x $page.diffoldbgbut $page.diffoldbg -sticky w label $page.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1] - ${NS}::button $page.diffnewbut -text [mc "Diff: new lines"] \ + ttk::button $page.diffnewbut -text [mc "Diff: new lines"] \ -command [list choosecolor diffcolors 1 $page.diffnew [mc "diff new lines"] \ [list $ctext tag conf dresult -foreground]] grid x $page.diffnewbut $page.diffnew -sticky w label $page.diffnewbg -padx 40 -relief sunk -background [lindex $diffbgcolors 1] - ${NS}::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \ + ttk::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \ -command [list choosecolor diffbgcolors 1 $page.diffnewbg \ [mc "diff new lines bg"] \ [list $ctext tag conf dresult -background]] grid x $page.diffnewbgbut $page.diffnewbg -sticky w label $page.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2] - ${NS}::button $page.hunksepbut -text [mc "Diff: hunk header"] \ + ttk::button $page.hunksepbut -text [mc "Diff: hunk header"] \ -command [list choosecolor diffcolors 2 $page.hunksep \ [mc "diff hunk header"] \ [list $ctext tag conf hunksep -foreground]] grid x $page.hunksepbut $page.hunksep -sticky w label $page.markbgsep -padx 40 -relief sunk -background $markbgcolor - ${NS}::button $page.markbgbut -text [mc "Marked line bg"] \ + ttk::button $page.markbgbut -text [mc "Marked line bg"] \ -command [list choosecolor markbgcolor {} $page.markbgsep \ [mc "marked line background"] \ [list $ctext tag conf omark -background]] grid x $page.markbgbut $page.markbgsep -sticky w label $page.selbgsep -padx 40 -relief sunk -background $selectbgcolor - ${NS}::button $page.selbgbut -text [mc "Select bg"] \ + ttk::button $page.selbgbut -text [mc "Select bg"] \ -command [list choosecolor selectbgcolor {} $page.selbgsep [mc "background"] setselbg] grid x $page.selbgbut $page.selbgsep -sticky w return $page } proc prefspage_fonts {notebook} { - global NS set page [create_prefs_page $notebook.fonts] - ${NS}::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold + ttk::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold grid $page.cfont - -sticky w -pady 10 mkfontdisp mainfont $page [mc "Main font"] mkfontdisp textfont $page [mc "Diff display font"] @@ -11922,11 +11782,8 @@ proc prefspage_fonts {notebook} { } proc doprefs {} { - global maxwidth maxgraphpct use_ttk NS - global oldprefs prefstop showneartags showlocalchanges - global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor - global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs - global hideremotes want_ttk have_ttk wrapcomment wrapdefault + global oldprefs prefstop + global {*}$::config_variables set top .gitkprefs set prefstop $top @@ -11934,49 +11791,34 @@ proc doprefs {} { raise $top return } - foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ - limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { + foreach v $::config_variables { set oldprefs($v) [set $v] } ttk_toplevel $top wm title $top [mc "Gitk preferences"] make_transient $top . - if {[set use_notebook [expr {$use_ttk && [info command ::ttk::notebook] ne ""}]]} { - set notebook [ttk::notebook $top.notebook] - } else { - set notebook [${NS}::frame $top.notebook -borderwidth 0 -relief flat] - } + set notebook [ttk::notebook $top.notebook] lappend pages [prefspage_general $notebook] [mc "General"] lappend pages [prefspage_colors $notebook] [mc "Colors"] lappend pages [prefspage_fonts $notebook] [mc "Fonts"] set col 0 foreach {page title} $pages { - if {$use_notebook} { - $notebook add $page -text $title - } else { - set btn [${NS}::button $notebook.b_[string map {. X} $page] \ - -text $title -command [list raise $page]] - $page configure -text $title - grid $btn -row 0 -column [incr col] -sticky w - grid $page -row 1 -column 0 -sticky news -columnspan 100 - } + $notebook add $page -text $title } - if {!$use_notebook} { - grid columnconfigure $notebook 0 -weight 1 - grid rowconfigure $notebook 1 -weight 1 - raise [lindex $pages 0] - } + grid columnconfigure $notebook 0 -weight 1 + grid rowconfigure $notebook 1 -weight 1 + raise [lindex $pages 0] grid $notebook -sticky news -padx 2 -pady 2 grid rowconfigure $top 0 -weight 1 grid columnconfigure $top 0 -weight 1 - ${NS}::frame $top.buts - ${NS}::button $top.buts.ok -text [mc "OK"] -command prefsok -default active - ${NS}::button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal + ttk::frame $top.buts + ttk::button $top.buts.ok -text [mc "OK"] -command prefsok -default active + ttk::button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal bind $top <Key-Return> prefsok bind $top <Key-Escape> prefscan grid $top.buts.ok $top.buts.can @@ -12059,10 +11901,9 @@ proc setfg {c} { proc prefscan {} { global oldprefs prefstop + global {*}$::config_variables - foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ - limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { - global $v + foreach v $::config_variables { set $v $oldprefs($v) } catch {destroy $prefstop} @@ -12071,11 +11912,8 @@ proc prefscan {} { } proc prefsok {} { - global maxwidth maxgraphpct - global oldprefs prefstop showneartags showlocalchanges - global fontpref mainfont textfont uifont - global limitdiffs treediffs perfile_attrs - global hideremotes wrapcomment wrapdefault + global oldprefs prefstop fontpref treediffs + global {*}$::config_variables global ctext catch {destroy $prefstop} @@ -12517,13 +12355,6 @@ namespace import ::msgcat::mc ## And eventually load the actual message catalog ::msgcat::mcload $gitk_msgsdir -# First check that Tcl/Tk is recent enough -if {[catch {package require Tk 8.4} err]} { - show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\ - Gitk requires at least Tcl/Tk 8.4."] - exit 1 -} - # on OSX bring the current Wish process window to front if {[tk windowingsystem] eq "aqua"} { safe_exec [list osascript -e [format { @@ -12569,6 +12400,17 @@ catch { } } +# Use object format as hash algorightm (either "sha1" or "sha256") +set hashalgorithm [exec git rev-parse --show-object-format] +if {$hashalgorithm eq "sha1"} { + set hashlength 40 +} elseif {$hashalgorithm eq "sha256"} { + set hashlength 64 +} else { + puts stderr "Unknown hash algorithm: $hashalgorithm" + exit 1 +} + set log_showroot true catch { set log_showroot [exec git config --bool --get log.showroot] @@ -12602,17 +12444,18 @@ set wrapcomment "none" set wrapdefault "none" set showneartags 1 set hideremotes 0 +set sortrefsbytype 1 set maxrefs 20 set visiblerefs {"master"} set maxlinelen 200 set showlocalchanges 1 set limitdiffs 1 +set kscroll 3 set datetimeformat "%Y-%m-%d %H:%M:%S" set autocopy 0 set autoselect 1 -set autosellen 40 +set autosellen $hashlength set perfile_attrs 0 -set want_ttk 1 if {[tk windowingsystem] eq "aqua"} { set extdifftool "opendiff" @@ -12705,19 +12548,66 @@ catch { config_check_tmp_exists 50 set config_variables { - mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth - cmitmode wrapcomment wrapdefault autocopy autoselect autosellen - showneartags maxrefs visiblerefs - hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk - bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors - markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor - extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor - remotebgcolor tagbgcolor tagfgcolor tagoutlinecolor reflinecolor - filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor - linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor - indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors + autocopy + autoselect + autosellen + bgcolor + circlecolors + circleoutlinecolor + cmitmode + colors + currentsearchhitbgcolor + datetimeformat + diffbgcolors + diffcolors + diffcontext + extdifftool + fgcolor + filesepbgcolor + filesepfgcolor + findmergefiles + foundbgcolor + headbgcolor + headfgcolor + headoutlinecolor + hideremotes + indexcirclecolor + kscroll + limitdiffs + linehoverbgcolor + linehoverfgcolor + linehoveroutlinecolor + linkfgcolor + mainfont + mainheadcirclecolor + markbgcolor + maxgraphpct + maxrefs + maxwidth + mergecolors + perfile_attrs + reflinecolor + remotebgcolor + selectbgcolor + showlocalchanges + showneartags + sortrefsbytype + tabstop + tagbgcolor + tagfgcolor + tagoutlinecolor + textfont + uicolor + uifgcolor + uifgdisabledcolor + uifont + visiblerefs web_browser + workingfilescirclecolor + wrapcomment + wrapdefault } + foreach var $config_variables { config_init_trace $var trace add variable $var write config_variable_change_cb @@ -12808,25 +12698,7 @@ set nullid "0000000000000000000000000000000000000000" set nullid2 "0000000000000000000000000000000000000001" set nullfile "/dev/null" -set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] -set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}] -if {![info exists have_ttk]} { - set have_ttk [llength [info commands ::ttk::style]] -} -set use_ttk [expr {$have_ttk && $want_ttk}] -set NS [expr {$use_ttk ? "ttk" : ""}] - -if {$use_ttk} { - setttkstyle -} - -regexp {^git version ([\d.]*\d)} [exec git version] _ git_version - -set show_notes {} -if {[package vcompare $git_version "1.6.6.2"] >= 0} { - set show_notes "--show-notes" -} - +setttkstyle set appname "gitk" set runq {} diff --git a/gpg-interface.c b/gpg-interface.c index 0896458de5..d26c7135b0 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -144,6 +144,18 @@ static struct gpg_format *get_format_by_sig(const char *sig) return NULL; } +const char *get_signature_format(const char *buf) +{ + struct gpg_format *format = get_format_by_sig(buf); + return format ? format->name : "unknown"; +} + +int valid_signature_format(const char *format) +{ + return (!!get_format_by_name(format) || + !strcmp(format, "unknown")); +} + void signature_check_clear(struct signature_check *sigc) { FREE_AND_NULL(sigc->payload); @@ -783,7 +795,7 @@ static int git_gpg_config(const char *var, const char *value, if (fmtname) { fmt = get_format_by_name(fmtname); - return git_config_string((char **) &fmt->program, var, value); + return git_config_pathname((char **) &fmt->program, var, value); } return 0; @@ -1048,7 +1060,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature, key_file->filename.buf); goto out; } - ssh_signing_key_file = strbuf_detach(&key_file->filename, NULL); + ssh_signing_key_file = xstrdup(key_file->filename.buf); } else { /* We assume a file */ ssh_signing_key_file = interpolate_path(signing_key, 1); diff --git a/gpg-interface.h b/gpg-interface.h index e09f12e8d0..60ddf8bbfa 100644 --- a/gpg-interface.h +++ b/gpg-interface.h @@ -48,6 +48,18 @@ struct signature_check { void signature_check_clear(struct signature_check *sigc); /* + * Return the format of the signature (like "openpgp", "x509", "ssh" + * or "unknown"). + */ +const char *get_signature_format(const char *buf); + +/* + * Is the signature format valid (like "openpgp", "x509", "ssh" or + * "unknown") + */ +int valid_signature_format(const char *format); + +/* * Look at a GPG signed tag object. If such a signature exists, store it in * signature and the signed content in payload. Return 1 if a signature was * found, and 0 otherwise. @@ -175,6 +175,16 @@ static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *s /* Number of algorithms supported (including unknown). */ #define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) +/* Default hash algorithm if unspecified. */ +#ifdef WITH_BREAKING_CHANGES +# define GIT_HASH_DEFAULT GIT_HASH_SHA256 +#else +# define GIT_HASH_DEFAULT GIT_HASH_SHA1 +#endif + +/* Legacy hash algorithm. Implied for older data formats which don't specify. */ +#define GIT_HASH_SHA1_LEGACY GIT_HASH_SHA1 + /* "sha1", big-endian */ #define GIT_SHA1_FORMAT_ID 0x73686131 @@ -810,6 +810,9 @@ void get_version_info(struct strbuf *buf, int show_build_options) SHA1_UNSAFE_BACKEND); #endif strbuf_addf(buf, "SHA-256: %s\n", SHA256_BACKEND); + strbuf_addf(buf, "default-ref-format: %s\n", + ref_storage_format_to_name(REF_STORAGE_FORMAT_DEFAULT)); + strbuf_addf(buf, "default-hash: %s\n", hash_algos[GIT_HASH_DEFAULT].name); } } diff --git a/line-log.c b/line-log.c index 628e3fe3ae..07f2154e84 100644 --- a/line-log.c +++ b/line-log.c @@ -1172,12 +1172,13 @@ static int bloom_filter_check(struct rev_info *rev, return 0; while (!result && range) { - fill_bloom_key(range->path, strlen(range->path), &key, rev->bloom_filter_settings); + bloom_key_fill(&key, range->path, strlen(range->path), + rev->bloom_filter_settings); if (bloom_filter_contains(filter, &key, rev->bloom_filter_settings)) result = 1; - clear_bloom_key(&key); + bloom_key_clear(&key); range = range->next; } diff --git a/meson.build b/meson.build index 738e89feec..9bc1826cb6 100644 --- a/meson.build +++ b/meson.build @@ -245,7 +245,7 @@ time = find_program('time', dirs: program_path, required: get_option('benchmarks # "/bin/sh" over a PATH-based lookup, which provides a working shell on most # supported systems. This path is also the default shell path used by our # Makefile. This lookup can be overridden via `program_path`. -target_shell = find_program('sh', dirs: program_path + [ '/bin' ], native: false) +target_shell = find_program('/bin/sh', 'sh', dirs: program_path, native: false) # Sanity-check that programs required for the build exist. foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname'] @@ -866,9 +866,11 @@ if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' endif build_options_config.set_quoted('X', executable_suffix) -python = import('python').find_installation('python3', required: get_option('python')) -target_python = find_program('python3', native: false, required: python.found()) -if python.found() +# Python is not used for our build system, but exclusively for git-p4. +# Consequently we only need to determine whether Python is available for the +# build target. +target_python = find_program('python3', native: false, required: get_option('python')) +if target_python.found() build_options_config.set('NO_PYTHON', '') else libgit_c_args += '-DNO_PYTHON' @@ -1331,10 +1333,6 @@ if host_machine.system() != 'windows' endif endif -if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>') - libgit_c_args += '-DHAVE_SYSINFO' -endif - if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>') libgit_c_args += '-DUSE_ST_TIMESPEC' elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>') @@ -1420,17 +1418,6 @@ if compiler.compiles(''' libgit_c_args += '-DHAVE_CLOCK_MONOTONIC' endif -if not compiler.compiles(''' - #include <inttypes.h> - - void func(void) - { - uintmax_t x = 0; - } -''', name: 'uintmax_t') - libgit_c_args += '-DNO_UINTMAX_T' -endif - has_bsd_sysctl = false if compiler.has_header('sys/sysctl.h') if compiler.compiles(''' @@ -1449,6 +1436,12 @@ if compiler.has_header('sys/sysctl.h') endif endif +if not has_bsd_sysctl + if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>') + libgit_c_args += '-DHAVE_SYSINFO' + endif +endif + if not meson.is_cross_build() and compiler.run(''' #include <stdio.h> @@ -1744,7 +1737,7 @@ git_builtin = executable('git', sources: builtin_sources + 'git.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) bin_wrappers += git_builtin @@ -1752,35 +1745,35 @@ test_dependencies += executable('git-daemon', sources: 'daemon.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) test_dependencies += executable('git-sh-i18n--envsubst', sources: 'sh-i18n--envsubst.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) bin_wrappers += executable('git-shell', sources: 'shell.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) test_dependencies += executable('git-http-backend', sources: 'http-backend.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) bin_wrappers += executable('scalar', sources: 'scalar.c', dependencies: [libgit_commonmain], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) if curl.found() @@ -1796,14 +1789,14 @@ if curl.found() sources: 'remote-curl.c', dependencies: [libgit_curl], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) test_dependencies += executable('git-http-fetch', sources: 'http-fetch.c', dependencies: [libgit_curl], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) if expat.found() @@ -1811,7 +1804,7 @@ if curl.found() sources: 'http-push.c', dependencies: [libgit_curl], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) endif @@ -1822,7 +1815,7 @@ if curl.found() ) install_symlink(alias + executable_suffix, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, pointing_to: 'git-remote-http', ) endforeach @@ -1832,7 +1825,7 @@ test_dependencies += executable('git-imap-send', sources: 'imap-send.c', dependencies: [ use_curl_for_imap_send ? libgit_curl : libgit_commonmain ], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ] @@ -1842,7 +1835,7 @@ foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ] ) install_symlink(alias + executable_suffix, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, pointing_to: 'git', ) endforeach @@ -1856,9 +1849,9 @@ foreach symlink : [ 'scalar', ] if meson.version().version_compare('>=1.3.0') - pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')) + pointing_to = fs.relative_to(git_exec_path / symlink, get_option('bindir')) else - pointing_to = '../libexec/git-core' / symlink + pointing_to = '..' / git_exec_path / symlink endif install_symlink(symlink, @@ -1898,7 +1891,7 @@ foreach script : scripts_sh meson.project_build_root() / 'GIT-BUILD-OPTIONS', ], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) endforeach @@ -1931,7 +1924,7 @@ if perl_features_enabled input: perl_header_template, output: 'GIT-PERL-HEADER', configuration: { - 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core', + 'GITEXECDIR_REL': git_exec_path, 'PERLLIBDIR_REL': perllibdir, 'LOCALEDIR_REL': get_option('datadir') / 'locale', 'INSTLIBDIR': perllibdir, @@ -1955,7 +1948,7 @@ if perl_features_enabled output: fs.stem(script), command: generate_perl_command, install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, depends: [git_version_file], ) test_dependencies += generated_script @@ -1964,9 +1957,9 @@ if perl_features_enabled bin_wrappers += generated_script if meson.version().version_compare('>=1.3.0') - pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')) + pointing_to = fs.relative_to(git_exec_path / fs.stem(script), get_option('bindir')) else - pointing_to = '../libexec/git-core' / fs.stem(script) + pointing_to = '..' / git_exec_path / fs.stem(script) endif install_symlink(fs.stem(script), @@ -1979,7 +1972,7 @@ if perl_features_enabled subdir('perl') endif -if python.found() +if target_python.found() scripts_python = [ 'git-p4.py' ] @@ -1996,7 +1989,7 @@ if python.found() '@OUTPUT@', ], install: true, - install_dir: get_option('libexecdir') / 'git-core', + install_dir: git_exec_path, ) test_dependencies += generated_python endforeach @@ -2030,7 +2023,7 @@ mergetools = [ ] foreach mergetool : mergetools - install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools') + install_data(mergetool, install_dir: git_exec_path / 'mergetools') endforeach if intl.found() @@ -2144,6 +2137,18 @@ if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc' alias_target('check-headers', hdr_check) endif +git_clang_format = find_program('git-clang-format', required: false, native: true) +if git_clang_format.found() + run_target('style', + command: [ + git_clang_format, + '--style', 'file', + '--diff', + '--extensions', 'c,h' + ] + ) +endif + foreach key, value : { 'DIFF': diff.full_path(), 'GIT_SOURCE_DIR': meson.project_source_root(), @@ -2194,16 +2199,15 @@ meson.add_dist_script( summary({ 'benchmarks': get_option('tests') and perl.found() and time.found(), - 'curl': curl.found(), - 'expat': expat.found(), - 'gettext': intl.found(), + 'curl': curl, + 'expat': expat, + 'gettext': intl, 'gitweb': gitweb_option.allowed(), - 'https': https_backend, - 'iconv': iconv.found(), - 'pcre2': pcre2.found(), + 'iconv': iconv, + 'pcre2': pcre2, 'perl': perl_features_enabled, - 'python': python.found(), -}, section: 'Auto-detected features') + 'python': target_python.found(), +}, section: 'Auto-detected features', bool_yn: true) summary({ 'csprng': csprng_backend, diff --git a/object-name.c b/object-name.c index 27138b55b4..11aa0e6afc 100644 --- a/object-name.c +++ b/object-name.c @@ -28,6 +28,7 @@ #include "commit-reach.h" #include "date.h" #include "object-file-convert.h" +#include "prio-queue.h" static int get_oid_oneline(struct repository *r, const char *, struct object_id *, const struct commit_list *); @@ -1469,7 +1470,7 @@ static int get_oid_oneline(struct repository *r, const char *prefix, struct object_id *oid, const struct commit_list *list) { - struct commit_list *copy = NULL, **copy_tail = © + struct prio_queue copy = { compare_commits_by_commit_date }; const struct commit_list *l; int found = 0; int negative = 0; @@ -1491,9 +1492,9 @@ static int get_oid_oneline(struct repository *r, for (l = list; l; l = l->next) { l->item->object.flags |= ONELINE_SEEN; - copy_tail = &commit_list_insert(l->item, copy_tail)->next; + prio_queue_put(©, l->item); } - while (copy) { + while (copy.nr) { const char *p, *buf; struct commit *commit; int matches; @@ -1515,7 +1516,7 @@ static int get_oid_oneline(struct repository *r, regfree(®ex); for (l = list; l; l = l->next) clear_commit_marks(l->item, ONELINE_SEEN); - free_commit_list(copy); + clear_prio_queue(©); return found ? 0 : -1; } @@ -2069,7 +2070,6 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo, cb.list = &list; refs_for_each_ref(get_main_ref_store(repo), handle_one_ref, &cb); refs_head_ref(get_main_ref_store(repo), handle_one_ref, &cb); - commit_list_sort_by_date(&list); ret = get_oid_oneline(repo, name + 2, oid, list); free_commit_list(list); diff --git a/pack-bitmap.c b/pack-bitmap.c index 64278e2acf..d14421ee20 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -31,6 +31,7 @@ struct stored_bitmap { struct object_id oid; struct ewah_bitmap *root; struct stored_bitmap *xor; + size_t map_pos; int flags; }; @@ -314,13 +315,14 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index, struct ewah_bitmap *root, const struct object_id *oid, struct stored_bitmap *xor_with, - int flags) + int flags, size_t map_pos) { struct stored_bitmap *stored; khiter_t hash_pos; int ret; stored = xmalloc(sizeof(struct stored_bitmap)); + stored->map_pos = map_pos; stored->root = root; stored->xor = xor_with; stored->flags = flags; @@ -376,10 +378,12 @@ static int load_bitmap_entries_v1(struct bitmap_index *index) struct stored_bitmap *xor_bitmap = NULL; uint32_t commit_idx_pos; struct object_id oid; + size_t entry_map_pos; if (index->map_size - index->map_pos < 6) return error(_("corrupt ewah bitmap: truncated header for entry %d"), i); + entry_map_pos = index->map_pos; commit_idx_pos = read_be32(index->map, &index->map_pos); xor_offset = read_u8(index->map, &index->map_pos); flags = read_u8(index->map, &index->map_pos); @@ -402,8 +406,9 @@ static int load_bitmap_entries_v1(struct bitmap_index *index) if (!bitmap) return -1; - recent_bitmaps[i % MAX_XOR_OFFSET] = store_bitmap( - index, bitmap, &oid, xor_bitmap, flags); + recent_bitmaps[i % MAX_XOR_OFFSET] = + store_bitmap(index, bitmap, &oid, xor_bitmap, flags, + entry_map_pos); } return 0; @@ -630,41 +635,28 @@ static int load_bitmap(struct repository *r, struct bitmap_index *bitmap_git, bitmap_git->ext_index.positions = kh_init_oid_pos(); if (load_reverse_index(r, bitmap_git)) - goto failed; + return -1; if (!(bitmap_git->commits = read_bitmap_1(bitmap_git)) || !(bitmap_git->trees = read_bitmap_1(bitmap_git)) || !(bitmap_git->blobs = read_bitmap_1(bitmap_git)) || !(bitmap_git->tags = read_bitmap_1(bitmap_git))) - goto failed; + return -1; if (!bitmap_git->table_lookup && load_bitmap_entries_v1(bitmap_git) < 0) - goto failed; + return -1; if (bitmap_git->base) { if (!bitmap_is_midx(bitmap_git)) BUG("non-MIDX bitmap has non-NULL base bitmap index"); if (load_bitmap(r, bitmap_git->base, 1) < 0) - goto failed; + return -1; } if (!recursing) load_all_type_bitmaps(bitmap_git); return 0; - -failed: - munmap(bitmap_git->map, bitmap_git->map_size); - bitmap_git->map = NULL; - bitmap_git->map_size = 0; - - kh_destroy_oid_map(bitmap_git->bitmaps); - bitmap_git->bitmaps = NULL; - - kh_destroy_oid_pos(bitmap_git->ext_index.positions); - bitmap_git->ext_index.positions = NULL; - - return -1; } static int open_pack_bitmap(struct repository *r, @@ -884,6 +876,7 @@ static struct stored_bitmap *lazy_bitmap_for_commit(struct bitmap_index *bitmap_ int xor_flags; khiter_t hash_pos; struct bitmap_lookup_table_xor_item *xor_item; + size_t entry_map_pos; if (is_corrupt) return NULL; @@ -943,6 +936,7 @@ static struct stored_bitmap *lazy_bitmap_for_commit(struct bitmap_index *bitmap_ goto corrupt; } + entry_map_pos = bitmap_git->map_pos; bitmap_git->map_pos += sizeof(uint32_t) + sizeof(uint8_t); xor_flags = read_u8(bitmap_git->map, &bitmap_git->map_pos); bitmap = read_bitmap_1(bitmap_git); @@ -950,7 +944,8 @@ static struct stored_bitmap *lazy_bitmap_for_commit(struct bitmap_index *bitmap_ if (!bitmap) goto corrupt; - xor_bitmap = store_bitmap(bitmap_git, bitmap, &xor_item->oid, xor_bitmap, xor_flags); + xor_bitmap = store_bitmap(bitmap_git, bitmap, &xor_item->oid, + xor_bitmap, xor_flags, entry_map_pos); xor_items_nr--; } @@ -984,6 +979,7 @@ static struct stored_bitmap *lazy_bitmap_for_commit(struct bitmap_index *bitmap_ * Instead, we can skip ahead and immediately read the flags and * ewah bitmap. */ + entry_map_pos = bitmap_git->map_pos; bitmap_git->map_pos += sizeof(uint32_t) + sizeof(uint8_t); flags = read_u8(bitmap_git->map, &bitmap_git->map_pos); bitmap = read_bitmap_1(bitmap_git); @@ -991,7 +987,8 @@ static struct stored_bitmap *lazy_bitmap_for_commit(struct bitmap_index *bitmap_ if (!bitmap) goto corrupt; - return store_bitmap(bitmap_git, bitmap, oid, xor_bitmap, flags); + return store_bitmap(bitmap_git, bitmap, oid, xor_bitmap, flags, + entry_map_pos); corrupt: free(xor_items); @@ -2854,8 +2851,9 @@ int test_bitmap_commits(struct repository *r) die(_("failed to load bitmap indexes")); /* - * As this function is only used to print bitmap selected - * commits, we don't have to read the commit table. + * Since this function needs to print the bitmapped + * commits, bypass the commit lookup table (if one exists) + * by forcing the bitmap to eagerly load its entries. */ if (bitmap_git->table_lookup) { if (load_bitmap_entries_v1(bitmap_git) < 0) @@ -2871,6 +2869,48 @@ int test_bitmap_commits(struct repository *r) return 0; } +int test_bitmap_commits_with_offset(struct repository *r) +{ + struct object_id oid; + struct stored_bitmap *stored; + struct bitmap_index *bitmap_git; + size_t commit_idx_pos_map_pos, xor_offset_map_pos, flag_map_pos, + ewah_bitmap_map_pos; + + bitmap_git = prepare_bitmap_git(r); + if (!bitmap_git) + die(_("failed to load bitmap indexes")); + + /* + * Since this function needs to know the position of each individual + * bitmap, bypass the commit lookup table (if one exists) by forcing + * the bitmap to eagerly load its entries. + */ + if (bitmap_git->table_lookup) { + if (load_bitmap_entries_v1(bitmap_git) < 0) + die(_("failed to load bitmap indexes")); + } + + kh_foreach (bitmap_git->bitmaps, oid, stored, { + commit_idx_pos_map_pos = stored->map_pos; + xor_offset_map_pos = stored->map_pos + sizeof(uint32_t); + flag_map_pos = xor_offset_map_pos + sizeof(uint8_t); + ewah_bitmap_map_pos = flag_map_pos + sizeof(uint8_t); + + printf_ln("%s %"PRIuMAX" %"PRIuMAX" %"PRIuMAX" %"PRIuMAX, + oid_to_hex(&oid), + (uintmax_t)commit_idx_pos_map_pos, + (uintmax_t)xor_offset_map_pos, + (uintmax_t)flag_map_pos, + (uintmax_t)ewah_bitmap_map_pos); + }) + ; + + free_bitmap_index(bitmap_git); + + return 0; +} + int test_bitmap_hashes(struct repository *r) { struct bitmap_index *bitmap_git = prepare_bitmap_git(r); diff --git a/pack-bitmap.h b/pack-bitmap.h index 382d39499a..1bd7a791e2 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -81,6 +81,7 @@ void traverse_bitmap_commit_list(struct bitmap_index *, show_reachable_fn show_reachable); void test_bitmap_walk(struct rev_info *revs); int test_bitmap_commits(struct repository *r); +int test_bitmap_commits_with_offset(struct repository *r); int test_bitmap_hashes(struct repository *r); int test_bitmap_pseudo_merges(struct repository *r); int test_bitmap_pseudo_merge_commits(struct repository *r, uint32_t n); diff --git a/parse-options.c b/parse-options.c index a9a39ecaef..5224203ffe 100644 --- a/parse-options.c +++ b/parse-options.c @@ -68,6 +68,64 @@ static char *fix_filename(const char *prefix, const char *file) return prefix_filename_except_for_dash(prefix, file); } +static int do_get_int_value(const void *value, size_t precision, intmax_t *ret) +{ + switch (precision) { + case sizeof(int8_t): + *ret = *(int8_t *)value; + return 0; + case sizeof(int16_t): + *ret = *(int16_t *)value; + return 0; + case sizeof(int32_t): + *ret = *(int32_t *)value; + return 0; + case sizeof(int64_t): + *ret = *(int64_t *)value; + return 0; + default: + return -1; + } +} + +static intmax_t get_int_value(const struct option *opt, enum opt_parsed flags) +{ + intmax_t ret; + if (do_get_int_value(opt->value, opt->precision, &ret)) + BUG("invalid precision for option %s", optname(opt, flags)); + return ret; +} + +static enum parse_opt_result set_int_value(const struct option *opt, + enum opt_parsed flags, + intmax_t value) +{ + switch (opt->precision) { + case sizeof(int8_t): + *(int8_t *)opt->value = value; + return 0; + case sizeof(int16_t): + *(int16_t *)opt->value = value; + return 0; + case sizeof(int32_t): + *(int32_t *)opt->value = value; + return 0; + case sizeof(int64_t): + *(int64_t *)opt->value = value; + return 0; + default: + BUG("invalid precision for option %s", optname(opt, flags)); + } +} + +static int signed_int_fits(intmax_t value, size_t precision) +{ + size_t bits = precision * CHAR_BIT; + intmax_t upper_bound = INTMAX_MAX >> (bitsizeof(intmax_t) - bits); + intmax_t lower_bound = -upper_bound - 1; + return lower_bound <= value && value <= upper_bound; +} + static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p, const struct option *opt, enum opt_parsed flags, @@ -89,35 +147,55 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p, return opt->ll_callback(p, opt, NULL, unset); case OPTION_BIT: + { + intmax_t value = get_int_value(opt, flags); if (unset) - *(int *)opt->value &= ~opt->defval; + value &= ~opt->defval; else - *(int *)opt->value |= opt->defval; - return 0; + value |= opt->defval; + return set_int_value(opt, flags, value); + } case OPTION_NEGBIT: + { + intmax_t value = get_int_value(opt, flags); if (unset) - *(int *)opt->value |= opt->defval; + value |= opt->defval; else - *(int *)opt->value &= ~opt->defval; - return 0; + value &= ~opt->defval; + return set_int_value(opt, flags, value); + } case OPTION_BITOP: + { + intmax_t value = get_int_value(opt, flags); if (unset) BUG("BITOP can't have unset form"); - *(int *)opt->value &= ~opt->extra; - *(int *)opt->value |= opt->defval; - return 0; + value &= ~opt->extra; + value |= opt->defval; + return set_int_value(opt, flags, value); + } case OPTION_COUNTUP: - if (*(int *)opt->value < 0) - *(int *)opt->value = 0; - *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1; - return 0; + { + size_t bits = CHAR_BIT * opt->precision; + intmax_t upper_bound = INTMAX_MAX >> (bitsizeof(intmax_t) - bits); + intmax_t value = get_int_value(opt, flags); + + if (value < 0) + value = 0; + if (unset) + value = 0; + else if (value < upper_bound) + value++; + else + return error(_("value for %s exceeds %"PRIdMAX), + optname(opt, flags), upper_bound); + return set_int_value(opt, flags, value); + } case OPTION_SET_INT: - *(int *)opt->value = unset ? 0 : opt->defval; - return 0; + return set_int_value(opt, flags, unset ? 0 : opt->defval); case OPTION_STRING: if (unset) @@ -199,23 +277,7 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p, return error(_("value %s for %s not in range [%"PRIdMAX",%"PRIdMAX"]"), arg, optname(opt, flags), (intmax_t)lower_bound, (intmax_t)upper_bound); - switch (opt->precision) { - case 1: - *(int8_t *)opt->value = value; - return 0; - case 2: - *(int16_t *)opt->value = value; - return 0; - case 4: - *(int32_t *)opt->value = value; - return 0; - case 8: - *(int64_t *)opt->value = value; - return 0; - default: - BUG("invalid precision for option %s", - optname(opt, flags)); - } + return set_int_value(opt, flags, value); } case OPTION_UNSIGNED: { @@ -266,7 +328,9 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p, } struct parse_opt_cmdmode_list { - int value, *value_ptr; + intmax_t value; + void *value_ptr; + size_t precision; const struct option *opt; const char *arg; enum opt_parsed flags; @@ -280,7 +344,7 @@ static void build_cmdmode_list(struct parse_opt_ctx_t *ctx, for (; opts->type != OPTION_END; opts++) { struct parse_opt_cmdmode_list *elem = ctx->cmdmode_list; - int *value_ptr = opts->value; + void *value_ptr = opts->value; if (!(opts->flags & PARSE_OPT_CMDMODE) || !value_ptr) continue; @@ -292,10 +356,13 @@ static void build_cmdmode_list(struct parse_opt_ctx_t *ctx, CALLOC_ARRAY(elem, 1); elem->value_ptr = value_ptr; - elem->value = *value_ptr; + elem->precision = opts->precision; + if (do_get_int_value(value_ptr, opts->precision, &elem->value)) + optbug(opts, "has invalid precision"); elem->next = ctx->cmdmode_list; ctx->cmdmode_list = elem; } + BUG_if_bug("invalid 'struct option'"); } static char *optnamearg(const struct option *opt, const char *arg, @@ -317,7 +384,13 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p, char *opt_name, *other_opt_name; for (; elem; elem = elem->next) { - if (*elem->value_ptr == elem->value) + intmax_t new_value; + + if (do_get_int_value(elem->value_ptr, elem->precision, + &new_value)) + BUG("impossible: invalid precision"); + + if (new_value == elem->value) continue; if (elem->opt && @@ -327,7 +400,7 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p, elem->opt = opt; elem->arg = arg; elem->flags = flags; - elem->value = *elem->value_ptr; + elem->value = new_value; } if (result || !elem) @@ -586,10 +659,14 @@ static void parse_options_check(const struct option *opts) opts->long_name && !(opts->flags & PARSE_OPT_NONEG)) optbug(opts, "OPTION_SET_INT 0 should not be negatable"); switch (opts->type) { - case OPTION_COUNTUP: + case OPTION_SET_INT: case OPTION_BIT: case OPTION_NEGBIT: - case OPTION_SET_INT: + case OPTION_BITOP: + case OPTION_COUNTUP: + if (!signed_int_fits(opts->defval, opts->precision)) + optbug(opts, "has invalid defval"); + /* fallthru */ case OPTION_NUMBER: if ((opts->flags & PARSE_OPT_OPTARG) || !(opts->flags & PARSE_OPT_NOARG)) diff --git a/parse-options.h b/parse-options.h index 91c3e3c29b..312045604d 100644 --- a/parse-options.h +++ b/parse-options.h @@ -172,6 +172,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG|(f), \ .callback = NULL, \ @@ -182,6 +183,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG|(f), \ } @@ -190,6 +192,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG | (f), \ .defval = (i), \ @@ -238,6 +241,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG|PARSE_OPT_NONEG, \ .defval = (set), \ @@ -248,6 +252,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG, \ .defval = (b), \ @@ -260,6 +265,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, \ .defval = 1, \ @@ -269,6 +275,7 @@ struct option { .short_name = (s), \ .long_name = (l), \ .value = (v), \ + .precision = sizeof(*v), \ .help = (h), \ .flags = PARSE_OPT_CMDMODE|PARSE_OPT_NOARG|PARSE_OPT_NONEG | (f), \ .defval = (i), \ diff --git a/perl/Git.pm b/perl/Git.pm index 6f47d653ab..090cf77dab 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -1061,6 +1061,19 @@ sub _close_cat_blob { delete @$self{@vars}; } +# Given PORT, a port number or service name, return its numerical +# value else undef. +sub port_num { + my ($port) = @_; + + # Port can be either a positive integer within the 16-bit range... + if ($port =~ /^\d+$/ && $port > 0 && $port <= (2**16 - 1)) { + return $port; + } + + # ... or a symbolic port (service name). + return scalar getservbyname($port, ''); +} =item credential_read( FILEHANDLE ) diff --git a/pkt-line.c b/pkt-line.c index a5bcbc96fb..fc583feb26 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -617,7 +617,7 @@ void packet_reader_init(struct packet_reader *reader, int fd, reader->buffer_size = sizeof(packet_buffer); reader->options = options; reader->me = "git"; - reader->hash_algo = &hash_algos[GIT_HASH_SHA1]; + reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY]; strbuf_init(&reader->scratch, 0); } diff --git a/po/meson.build b/po/meson.build index d7154b6395..de3b4e2c38 100644 --- a/po/meson.build +++ b/po/meson.build @@ -8,6 +8,7 @@ translations = i18n.gettext('git', 'el', 'es', 'fr', + 'ga', 'id', 'is', 'it', diff --git a/prio-queue.c b/prio-queue.c index ec33ac27db..9748528ce6 100644 --- a/prio-queue.c +++ b/prio-queue.c @@ -58,22 +58,10 @@ void prio_queue_put(struct prio_queue *queue, void *thing) } } -void *prio_queue_get(struct prio_queue *queue) +static void sift_down_root(struct prio_queue *queue) { - void *result; size_t ix, child; - if (!queue->nr) - return NULL; - if (!queue->compare) - return queue->array[--queue->nr].data; /* LIFO */ - - result = queue->array[0].data; - if (!--queue->nr) - return result; - - queue->array[0] = queue->array[queue->nr]; - /* Push down the one at the root */ for (ix = 0; ix * 2 + 1 < queue->nr; ix = child) { child = ix * 2 + 1; /* left */ @@ -86,6 +74,23 @@ void *prio_queue_get(struct prio_queue *queue) swap(queue, child, ix); } +} + +void *prio_queue_get(struct prio_queue *queue) +{ + void *result; + + if (!queue->nr) + return NULL; + if (!queue->compare) + return queue->array[--queue->nr].data; /* LIFO */ + + result = queue->array[0].data; + if (!--queue->nr) + return result; + + queue->array[0] = queue->array[queue->nr]; + sift_down_root(queue); return result; } @@ -97,3 +102,17 @@ void *prio_queue_peek(struct prio_queue *queue) return queue->array[queue->nr - 1].data; return queue->array[0].data; } + +void prio_queue_replace(struct prio_queue *queue, void *thing) +{ + if (!queue->nr) { + prio_queue_put(queue, thing); + } else if (!queue->compare) { + queue->array[queue->nr - 1].ctr = queue->insertion_ctr++; + queue->array[queue->nr - 1].data = thing; + } else { + queue->array[0].ctr = queue->insertion_ctr++; + queue->array[0].data = thing; + sift_down_root(queue); + } +} diff --git a/prio-queue.h b/prio-queue.h index 38d032636d..da7fad2f1f 100644 --- a/prio-queue.h +++ b/prio-queue.h @@ -52,6 +52,14 @@ void *prio_queue_get(struct prio_queue *); */ void *prio_queue_peek(struct prio_queue *); +/* + * Replace the "thing" that compares the smallest with a new "thing", + * like prio_queue_get()+prio_queue_put() would do, but in a more + * efficient way. Does the same as prio_queue_put() if the queue is + * empty. + */ +void prio_queue_replace(struct prio_queue *queue, void *thing); + void clear_prio_queue(struct prio_queue *); /* Reverse the LIFO elements */ diff --git a/read-cache.c b/read-cache.c index 531d87e790..5cf41b81f1 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1456,7 +1456,8 @@ int repo_refresh_and_write_index(struct repository *repo, struct lock_file lock_file = LOCK_INIT; int fd, ret = 0; - fd = repo_hold_locked_index(repo, &lock_file, 0); + fd = repo_hold_locked_index(repo, &lock_file, + gentle ? 0 : LOCK_REPORT_ON_ERROR); if (!gentle && fd < 0) return -1; if (refresh_index(repo->index, refresh_flags, pathspec, seen, header_msg)) @@ -439,9 +439,9 @@ static int for_each_filter_refs(const char *refname, const char *referent, struct warn_if_dangling_data { struct ref_store *refs; FILE *fp; - const char *refname; const struct string_list *refnames; - const char *msg_fmt; + const char *indent; + int dry_run; }; static int warn_if_dangling_symref(const char *refname, const char *referent UNUSED, @@ -449,44 +449,34 @@ static int warn_if_dangling_symref(const char *refname, const char *referent UNU int flags, void *cb_data) { struct warn_if_dangling_data *d = cb_data; - const char *resolves_to; + const char *resolves_to, *msg; if (!(flags & REF_ISSYMREF)) return 0; resolves_to = refs_resolve_ref_unsafe(d->refs, refname, 0, NULL, NULL); if (!resolves_to - || (d->refname - ? strcmp(resolves_to, d->refname) - : !string_list_has_string(d->refnames, resolves_to))) { + || !string_list_has_string(d->refnames, resolves_to)) { return 0; } - fprintf(d->fp, d->msg_fmt, refname); - fputc('\n', d->fp); + msg = d->dry_run + ? _("%s%s will become dangling after %s is deleted\n") + : _("%s%s has become dangling after %s was deleted\n"); + fprintf(d->fp, msg, d->indent, refname, resolves_to); return 0; } -void refs_warn_dangling_symref(struct ref_store *refs, FILE *fp, - const char *msg_fmt, const char *refname) -{ - struct warn_if_dangling_data data = { - .refs = refs, - .fp = fp, - .refname = refname, - .msg_fmt = msg_fmt, - }; - refs_for_each_rawref(refs, warn_if_dangling_symref, &data); -} - void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp, - const char *msg_fmt, const struct string_list *refnames) + const char *indent, int dry_run, + const struct string_list *refnames) { struct warn_if_dangling_data data = { .refs = refs, .fp = fp, .refnames = refnames, - .msg_fmt = msg_fmt, + .indent = indent, + .dry_run = dry_run, }; refs_for_each_rawref(refs, warn_if_dangling_symref, &data); } @@ -452,10 +452,9 @@ static inline const char *has_glob_specials(const char *pattern) return strpbrk(pattern, "?*["); } -void refs_warn_dangling_symref(struct ref_store *refs, FILE *fp, - const char *msg_fmt, const char *refname); void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp, - const char *msg_fmt, const struct string_list *refnames); + const char *indent, int dry_run, + const struct string_list *refnames); /* * Flags for controlling behaviour of pack_refs() diff --git a/refs/files-backend.c b/refs/files-backend.c index 92c3d2c318..89ae4517a9 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2760,6 +2760,8 @@ static void files_transaction_cleanup(struct files_ref_store *refs, if (lock) { unlock_ref(lock); + try_remove_empty_parents(refs, update->refname, + REMOVE_EMPTY_PARENTS_REF); update->backend_data = NULL; } } diff --git a/remote-curl.c b/remote-curl.c index b8bc3a80cf..84f4694780 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -285,7 +285,7 @@ static const struct git_hash_algo *detect_hash_algo(struct discovery *heads) * back to SHA1, which may or may not be correct. */ if (!p) - return &hash_algos[GIT_HASH_SHA1]; + return &hash_algos[GIT_HASH_SHA1_LEGACY]; algo = hash_algo_by_length((p - heads->buf) / 2); if (algo == GIT_HASH_UNKNOWN) diff --git a/repository.c b/repository.c index c606e1153c..ecd691181f 100644 --- a/repository.c +++ b/repository.c @@ -285,6 +285,7 @@ int repo_init(struct repository *repo, repo_set_ref_storage_format(repo, format.ref_storage_format); repo->repository_format_worktree_config = format.worktree_config; repo->repository_format_relative_worktrees = format.relative_worktrees; + repo->repository_format_precious_objects = format.precious_objects; /* take ownership of format.partial_clone */ repo->repository_format_partial_clone = format.partial_clone; diff --git a/repository.h b/repository.h index 3a5ef9c781..042dc93f0f 100644 --- a/repository.h +++ b/repository.h @@ -20,6 +20,12 @@ enum ref_storage_format { REF_STORAGE_FORMAT_REFTABLE, }; +#ifdef WITH_BREAKING_CHANGES /* Git 3.0 */ +# define REF_STORAGE_FORMAT_DEFAULT REF_STORAGE_FORMAT_REFTABLE +#else +# define REF_STORAGE_FORMAT_DEFAULT REF_STORAGE_FORMAT_FILES +#endif + struct repo_path_cache { char *squash_msg; char *merge_msg; @@ -151,6 +157,7 @@ struct repository { /* Configurations */ int repository_format_worktree_config; int repository_format_relative_worktrees; + int repository_format_precious_objects; /* Indicate if a repository has a different 'commondir' from 'gitdir' */ unsigned different_commondir:1; diff --git a/revision.c b/revision.c index 0cd9890297..212ca0de27 100644 --- a/revision.c +++ b/revision.c @@ -675,24 +675,48 @@ static int forbid_bloom_filters(struct pathspec *spec) { if (spec->has_wildcard) return 1; - if (spec->nr > 1) - return 1; if (spec->magic & ~PATHSPEC_LITERAL) return 1; - if (spec->nr && (spec->items[0].magic & ~PATHSPEC_LITERAL)) - return 1; + for (size_t nr = 0; nr < spec->nr; nr++) + if (spec->items[nr].magic & ~PATHSPEC_LITERAL) + return 1; return 0; } -static void prepare_to_use_bloom_filter(struct rev_info *revs) +static void release_revisions_bloom_keyvecs(struct rev_info *revs); + +static int convert_pathspec_to_bloom_keyvec(struct bloom_keyvec **out, + const struct pathspec_item *pi, + const struct bloom_filter_settings *settings) { - struct pathspec_item *pi; char *path_alloc = NULL; - const char *path, *p; + const char *path; size_t len; - int path_component_nr = 1; + int res = 0; + + /* remove single trailing slash from path, if needed */ + if (pi->len > 0 && pi->match[pi->len - 1] == '/') { + path_alloc = xmemdupz(pi->match, pi->len - 1); + path = path_alloc; + } else + path = pi->match; + len = strlen(path); + if (!len) { + res = -1; + goto cleanup; + } + + *out = bloom_keyvec_new(path, len, settings); + +cleanup: + free(path_alloc); + return res; +} + +static void prepare_to_use_bloom_filter(struct rev_info *revs) +{ if (!revs->commits) return; @@ -708,48 +732,14 @@ static void prepare_to_use_bloom_filter(struct rev_info *revs) if (!revs->pruning.pathspec.nr) return; - pi = &revs->pruning.pathspec.items[0]; - - /* remove single trailing slash from path, if needed */ - if (pi->len > 0 && pi->match[pi->len - 1] == '/') { - path_alloc = xmemdupz(pi->match, pi->len - 1); - path = path_alloc; - } else - path = pi->match; - - len = strlen(path); - if (!len) { - revs->bloom_filter_settings = NULL; - free(path_alloc); - return; - } - - p = path; - while (*p) { - /* - * At this point, the path is normalized to use Unix-style - * path separators. This is required due to how the - * changed-path Bloom filters store the paths. - */ - if (*p == '/') - path_component_nr++; - p++; - } + revs->bloom_keyvecs_nr = revs->pruning.pathspec.nr; + CALLOC_ARRAY(revs->bloom_keyvecs, revs->bloom_keyvecs_nr); - revs->bloom_keys_nr = path_component_nr; - ALLOC_ARRAY(revs->bloom_keys, revs->bloom_keys_nr); - - fill_bloom_key(path, len, &revs->bloom_keys[0], - revs->bloom_filter_settings); - path_component_nr = 1; - - p = path + len - 1; - while (p > path) { - if (*p == '/') - fill_bloom_key(path, p - path, - &revs->bloom_keys[path_component_nr++], - revs->bloom_filter_settings); - p--; + for (int i = 0; i < revs->pruning.pathspec.nr; i++) { + if (convert_pathspec_to_bloom_keyvec(&revs->bloom_keyvecs[i], + &revs->pruning.pathspec.items[i], + revs->bloom_filter_settings)) + goto fail; } if (trace2_is_enabled() && !bloom_filter_atexit_registered) { @@ -757,14 +747,18 @@ static void prepare_to_use_bloom_filter(struct rev_info *revs) bloom_filter_atexit_registered = 1; } - free(path_alloc); + return; + +fail: + revs->bloom_filter_settings = NULL; + release_revisions_bloom_keyvecs(revs); } static int check_maybe_different_in_bloom_filter(struct rev_info *revs, struct commit *commit) { struct bloom_filter *filter; - int result = 1, j; + int result = 0; if (!revs->repo->objects->commit_graph) return -1; @@ -779,10 +773,10 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs, return -1; } - for (j = 0; result && j < revs->bloom_keys_nr; j++) { - result = bloom_filter_contains(filter, - &revs->bloom_keys[j], - revs->bloom_filter_settings); + for (size_t nr = 0; !result && nr < revs->bloom_keyvecs_nr; nr++) { + result = bloom_filter_contains_vec(filter, + revs->bloom_keyvecs[nr], + revs->bloom_filter_settings); } if (result) @@ -823,7 +817,7 @@ static int rev_compare_tree(struct rev_info *revs, return REV_TREE_SAME; } - if (revs->bloom_keys_nr && !nth_parent) { + if (revs->bloom_keyvecs_nr && !nth_parent) { bloom_ret = check_maybe_different_in_bloom_filter(revs, commit); if (bloom_ret == 0) @@ -850,7 +844,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit, if (!t1) return 0; - if (!nth_parent && revs->bloom_keys_nr) { + if (!nth_parent && revs->bloom_keyvecs_nr) { bloom_ret = check_maybe_different_in_bloom_filter(revs, commit); if (!bloom_ret) return 1; @@ -3113,7 +3107,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s /* Pickaxe, diff-filter and rename following need diffs */ if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) || - revs->diffopt.filter || + revs->diffopt.filter || revs->diffopt.filter_not || revs->diffopt.flags.follow_renames) revs->diff = 1; @@ -3202,6 +3196,14 @@ static void release_revisions_mailmap(struct string_list *mailmap) static void release_revisions_topo_walk_info(struct topo_walk_info *info); +static void release_revisions_bloom_keyvecs(struct rev_info *revs) +{ + for (size_t nr = 0; nr < revs->bloom_keyvecs_nr; nr++) + bloom_keyvec_free(revs->bloom_keyvecs[nr]); + FREE_AND_NULL(revs->bloom_keyvecs); + revs->bloom_keyvecs_nr = 0; +} + static void free_void_commit_list(void *list) { free_commit_list(list); @@ -3230,11 +3232,7 @@ void release_revisions(struct rev_info *revs) clear_decoration(&revs->treesame, free); line_log_free(revs); oidset_clear(&revs->missing_commits); - - for (int i = 0; i < revs->bloom_keys_nr; i++) - clear_bloom_key(&revs->bloom_keys[i]); - FREE_AND_NULL(revs->bloom_keys); - revs->bloom_keys_nr = 0; + release_revisions_bloom_keyvecs(revs); } static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child) diff --git a/revision.h b/revision.h index 6d369cdad6..ac843f58d0 100644 --- a/revision.h +++ b/revision.h @@ -62,7 +62,7 @@ struct repository; struct rev_info; struct string_list; struct saved_parents; -struct bloom_key; +struct bloom_keyvec; struct bloom_filter_settings; struct option; struct parse_opt_ctx_t; @@ -360,8 +360,8 @@ struct rev_info { /* Commit graph bloom filter fields */ /* The bloom filter key(s) for the pathspec */ - struct bloom_key *bloom_keys; - int bloom_keys_nr; + struct bloom_keyvec **bloom_keyvecs; + int bloom_keyvecs_nr; /* * The bloom filter settings used to generate the key. diff --git a/sane-ctype.h b/sane-ctype.h index cbea1b299b..4f476c4381 100644 --- a/sane-ctype.h +++ b/sane-ctype.h @@ -1,6 +1,15 @@ #ifndef SANE_CTYPE_H #define SANE_CTYPE_H +/* + * Explicitly include <ctype.h> so that its header guards kick in from here on. + * This ensures that the file won't get included after "sane-ctype.h", as that + * would otherwise lead to a compiler error because the function declarations + * for `int isascii(int c)` et al would be mangled by our macros with the same + * name. + */ +#include <ctype.h> + /* Sane ctype - no locale, and works with signed chars */ #undef isascii #undef isspace @@ -14,7 +14,7 @@ static int advertise_sid = -1; static int advertise_object_info = -1; -static int client_hash_algo = GIT_HASH_SHA1; +static int client_hash_algo = GIT_HASH_SHA1_LEGACY; static int always_advertise(struct repository *r UNUSED, struct strbuf *value UNUSED) @@ -753,7 +753,8 @@ static int check_repository_format_gently(const char *gitdir, struct repository_ die("%s", err.buf); } - repository_format_precious_objects = candidate->precious_objects; + the_repository->repository_format_precious_objects = candidate->precious_objects; + string_list_clear(&candidate->unknown_extensions, 0); string_list_clear(&candidate->v1_only_extensions, 0); @@ -835,9 +836,12 @@ static void init_repository_format(struct repository_format *format) int read_repository_format(struct repository_format *format, const char *path) { clear_repository_format(format); + format->hash_algo = GIT_HASH_SHA1_LEGACY; git_config_from_file(check_repo_format, path, format); - if (format->version == -1) + if (format->version == -1) { clear_repository_format(format); + format->hash_algo = GIT_HASH_SHA1_LEGACY; + } return format->version; } @@ -1864,6 +1868,8 @@ const char *setup_git_directory_gently(int *nongit_ok) the_repository->repository_format_partial_clone = repo_fmt.partial_clone; repo_fmt.partial_clone = NULL; + the_repository->repository_format_precious_objects = + repo_fmt.precious_objects; } } /* @@ -2222,11 +2228,11 @@ void initialize_repository_version(int hash_algo, * version will get adjusted by git-clone(1) once it has learned about * the remote repository's format. */ - if (hash_algo != GIT_HASH_SHA1 || + if (hash_algo != GIT_HASH_SHA1_LEGACY || ref_storage_format != REF_STORAGE_FORMAT_FILES) target_version = GIT_REPO_VERSION_READ; - if (hash_algo != GIT_HASH_SHA1 && hash_algo != GIT_HASH_UNKNOWN) + if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN) git_config_set("extensions.objectformat", hash_algos[hash_algo].name); else if (reinit) @@ -2481,6 +2487,18 @@ static int read_default_format_config(const char *key, const char *value, goto out; } + /* + * Enable the reftable format when "features.experimental" is enabled. + * "init.defaultRefFormat" takes precedence over this setting. + */ + if (!strcmp(key, "feature.experimental") && + cfg->ref_format == REF_STORAGE_FORMAT_UNKNOWN && + git_config_bool(key, value)) { + cfg->ref_format = REF_STORAGE_FORMAT_REFTABLE; + ret = 0; + goto out; + } + ret = 0; out: free(str); @@ -2541,6 +2559,8 @@ static void repository_format_configure(struct repository_format *repo_fmt, repo_fmt->ref_storage_format = ref_format; } else if (cfg.ref_format != REF_STORAGE_FORMAT_UNKNOWN) { repo_fmt->ref_storage_format = cfg.ref_format; + } else { + repo_fmt->ref_storage_format = REF_STORAGE_FORMAT_DEFAULT; } repo_set_ref_storage_format(the_repository, repo_fmt->ref_storage_format); } @@ -149,7 +149,7 @@ struct repository_format { { \ .version = -1, \ .is_bare = -1, \ - .hash_algo = GIT_HASH_SHA1, \ + .hash_algo = GIT_HASH_DEFAULT, \ .ref_storage_format = REF_STORAGE_FORMAT_FILES, \ .unknown_extensions = STRING_LIST_INIT_DUP, \ .v1_only_extensions = STRING_LIST_INIT_DUP, \ @@ -8,55 +8,55 @@ #include "utf8.h" #include "date.h" -int starts_with(const char *str, const char *prefix) +bool starts_with(const char *str, const char *prefix) { for (; ; str++, prefix++) if (!*prefix) - return 1; + return true; else if (*str != *prefix) - return 0; + return false; } -int istarts_with(const char *str, const char *prefix) +bool istarts_with(const char *str, const char *prefix) { for (; ; str++, prefix++) if (!*prefix) - return 1; + return true; else if (tolower(*str) != tolower(*prefix)) - return 0; + return false; } -int starts_with_mem(const char *str, size_t len, const char *prefix) +bool starts_with_mem(const char *str, size_t len, const char *prefix) { const char *end = str + len; for (; ; str++, prefix++) { if (!*prefix) - return 1; + return true; else if (str == end || *str != *prefix) - return 0; + return false; } } -int skip_to_optional_arg_default(const char *str, const char *prefix, +bool skip_to_optional_arg_default(const char *str, const char *prefix, const char **arg, const char *def) { const char *p; if (!skip_prefix(str, prefix, &p)) - return 0; + return false; if (!*p) { if (arg) *arg = def; - return 1; + return true; } if (*p != '=') - return 0; + return false; if (arg) *arg = p + 1; - return 1; + return true; } /* @@ -660,9 +660,9 @@ char *xstrvfmt(const char *fmt, va_list ap); __attribute__((format (printf, 1, 2))) char *xstrfmt(const char *fmt, ...); -int starts_with(const char *str, const char *prefix); -int istarts_with(const char *str, const char *prefix); -int starts_with_mem(const char *str, size_t len, const char *prefix); +bool starts_with(const char *str, const char *prefix); +bool istarts_with(const char *str, const char *prefix); +bool starts_with_mem(const char *str, size_t len, const char *prefix); /* * If the string "str" is the same as the string in "prefix", then the "arg" @@ -678,16 +678,16 @@ int starts_with_mem(const char *str, size_t len, const char *prefix); * can be used instead of !strcmp(arg, "--key") and then * skip_prefix(arg, "--key=", &arg) to parse such an option. */ -int skip_to_optional_arg_default(const char *str, const char *prefix, +bool skip_to_optional_arg_default(const char *str, const char *prefix, const char **arg, const char *def); -static inline int skip_to_optional_arg(const char *str, const char *prefix, +static inline bool skip_to_optional_arg(const char *str, const char *prefix, const char **arg) { return skip_to_optional_arg_default(str, prefix, arg, ""); } -static inline int ends_with(const char *str, const char *suffix) +static inline bool ends_with(const char *str, const char *suffix) { size_t len; return strip_suffix(str, suffix, &len); diff --git a/string-list.c b/string-list.c index bf061fec56..53faaa8420 100644 --- a/string-list.c +++ b/string-list.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "string-list.h" @@ -17,19 +15,19 @@ void string_list_init_dup(struct string_list *list) /* if there is no exact match, point to the index where the entry could be * inserted */ -static int get_entry_index(const struct string_list *list, const char *string, - int *exact_match) +static size_t get_entry_index(const struct string_list *list, const char *string, + int *exact_match) { - int left = -1, right = list->nr; + size_t left = 0, right = list->nr; compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; - while (left + 1 < right) { - int middle = left + (right - left) / 2; + while (left < right) { + size_t middle = left + (right - left) / 2; int compare = cmp(string, list->items[middle].string); if (compare < 0) right = middle; else if (compare > 0) - left = middle; + left = middle + 1; else { *exact_match = 1; return middle; @@ -40,14 +38,13 @@ static int get_entry_index(const struct string_list *list, const char *string, return right; } -/* returns -1-index if already exists */ -static int add_entry(int insert_at, struct string_list *list, const char *string) +static size_t add_entry(struct string_list *list, const char *string) { int exact_match = 0; - int index = insert_at != -1 ? insert_at : get_entry_index(list, string, &exact_match); + size_t index = get_entry_index(list, string, &exact_match); if (exact_match) - return -1 - index; + return index; ALLOC_GROW(list->items, list->nr+1, list->alloc); if (index < list->nr) @@ -63,10 +60,7 @@ static int add_entry(int insert_at, struct string_list *list, const char *string struct string_list_item *string_list_insert(struct string_list *list, const char *string) { - int index = add_entry(-1, list, string); - - if (index < 0) - index = -1 - index; + size_t index = add_entry(list, string); return list->items + index; } @@ -116,9 +110,9 @@ struct string_list_item *string_list_lookup(struct string_list *list, const char void string_list_remove_duplicates(struct string_list *list, int free_util) { if (list->nr > 1) { - int src, dst; + size_t dst = 1; compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; - for (src = dst = 1; src < list->nr; src++) { + for (size_t src = 1; src < list->nr; src++) { if (!cmp(list->items[dst - 1].string, list->items[src].string)) { if (list->strdup_strings) free(list->items[src].string); @@ -134,8 +128,8 @@ void string_list_remove_duplicates(struct string_list *list, int free_util) int for_each_string_list(struct string_list *list, string_list_each_func_t fn, void *cb_data) { - int i, ret = 0; - for (i = 0; i < list->nr; i++) + int ret = 0; + for (size_t i = 0; i < list->nr; i++) if ((ret = fn(&list->items[i], cb_data))) break; return ret; @@ -144,8 +138,8 @@ int for_each_string_list(struct string_list *list, void filter_string_list(struct string_list *list, int free_util, string_list_each_func_t want, void *cb_data) { - int src, dst = 0; - for (src = 0; src < list->nr; src++) { + size_t dst = 0; + for (size_t src = 0; src < list->nr; src++) { if (want(&list->items[src], cb_data)) { list->items[dst++] = list->items[src]; } else { @@ -171,13 +165,12 @@ void string_list_remove_empty_items(struct string_list *list, int free_util) void string_list_clear(struct string_list *list, int free_util) { if (list->items) { - int i; if (list->strdup_strings) { - for (i = 0; i < list->nr; i++) + for (size_t i = 0; i < list->nr; i++) free(list->items[i].string); } if (free_util) { - for (i = 0; i < list->nr; i++) + for (size_t i = 0; i < list->nr; i++) free(list->items[i].util); } free(list->items); @@ -189,13 +182,12 @@ void string_list_clear(struct string_list *list, int free_util) void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc) { if (list->items) { - int i; if (clearfunc) { - for (i = 0; i < list->nr; i++) + for (size_t i = 0; i < list->nr; i++) clearfunc(list->items[i].util, list->items[i].string); } if (list->strdup_strings) { - for (i = 0; i < list->nr; i++) + for (size_t i = 0; i < list->nr; i++) free(list->items[i].string); } free(list->items); diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap index 2e0427dcfd..0e9292f97b 100644 --- a/subprojects/expat.wrap +++ b/subprojects/expat.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = expat-2.6.3 -source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz -source_filename = expat-2.6.3.tar.bz2 -source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc -patch_filename = expat_2.6.3-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch -patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2 -wrapdb_version = 2.6.3-1 +directory = expat-2.7.1 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.xz +source_filename = expat-2.7.1.tar.bz2 +source_hash = 354552544b8f99012e5062f7d570ec77f14b412a3ff5c7d8d0dae62c0d217c30 +patch_filename = expat_2.7.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.7.1-1/get_patch +patch_hash = fe28cbbc427a7c9787d08b969ad54d19f59d8dd18294b4a18651cecfc789d4ef +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.7.1-1/expat-2.7.1.tar.bz2 +wrapdb_version = 2.7.1-1 [provide] expat = expat_dep diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap index 7e18447254..f45c968e2f 100644 --- a/subprojects/pcre2.wrap +++ b/subprojects/pcre2.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = pcre2-10.44 -source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2 -source_filename = pcre2-10.44.tar.bz2 -source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96 -patch_filename = pcre2_10.44-2_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch -patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2 -wrapdb_version = 10.44-2 +directory = pcre2-10.45 +source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.tar.bz2 +source_filename = pcre2-10.45.tar.bz2 +source_hash = 21547f3516120c75597e5b30a992e27a592a31950b5140e7b8bfde3f192033c4 +patch_filename = pcre2_10.45-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.45-2/get_patch +patch_hash = 7c6f34b703708652a404f9dc2769c67658c437b6043573295fa3428a9b7a6807 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.45-2/pcre2-10.45.tar.bz2 +wrapdb_version = 10.45-2 [provide] libpcre2-8 = libpcre2_8 diff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c index 3f23f21072..16a01669e4 100644 --- a/t/helper/test-bitmap.c +++ b/t/helper/test-bitmap.c @@ -10,6 +10,11 @@ static int bitmap_list_commits(void) return test_bitmap_commits(the_repository); } +static int bitmap_list_commits_with_offset(void) +{ + return test_bitmap_commits_with_offset(the_repository); +} + static int bitmap_dump_hashes(void) { return test_bitmap_hashes(the_repository); @@ -36,6 +41,8 @@ int cmd__bitmap(int argc, const char **argv) if (argc == 2 && !strcmp(argv[1], "list-commits")) return bitmap_list_commits(); + if (argc == 2 && !strcmp(argv[1], "list-commits-with-offset")) + return bitmap_list_commits_with_offset(); if (argc == 2 && !strcmp(argv[1], "dump-hashes")) return bitmap_dump_hashes(); if (argc == 2 && !strcmp(argv[1], "dump-pseudo-merges")) @@ -46,6 +53,7 @@ int cmd__bitmap(int argc, const char **argv) return bitmap_dump_pseudo_merge_objects(atoi(argv[2])); usage("\ttest-tool bitmap list-commits\n" + "\ttest-tool bitmap list-commits-with-offset\n" "\ttest-tool bitmap dump-hashes\n" "\ttest-tool bitmap dump-pseudo-merges\n" "\ttest-tool bitmap dump-pseudo-merge-commits <n>\n" diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index 9aa2c5a592..3283544bd3 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -12,13 +12,13 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS; static void add_string_to_filter(const char *data, struct bloom_filter *filter) { struct bloom_key key; - fill_bloom_key(data, strlen(data), &key, &settings); + bloom_key_fill(&key, data, strlen(data), &settings); printf("Hashes:"); for (size_t i = 0; i < settings.num_hashes; i++) printf("0x%08x|", key.hashes[i]); printf("\n"); add_key_to_filter(&key, filter, &settings); - clear_bloom_key(&key); + bloom_key_clear(&key); } static void print_bloom_filter(struct bloom_filter *filter) { @@ -61,13 +61,13 @@ int cmd__bloom(int argc, const char **argv) uint32_t hashed; if (argc < 3) usage(bloom_usage); - hashed = murmur3_seeded_v2(0, argv[2], strlen(argv[2])); + hashed = test_bloom_murmur3_seeded(0, argv[2], strlen(argv[2]), 2); printf("Murmur3 Hash with seed=0:0x%08x\n", hashed); } if (!strcmp(argv[1], "get_murmur3_seven_highbit")) { uint32_t hashed; - hashed = murmur3_seeded_v2(0, "\x99\xaa\xbb\xcc\xdd\xee\xff", 7); + hashed = test_bloom_murmur3_seeded(0, "\x99\xaa\xbb\xcc\xdd\xee\xff", 7, 2); printf("Murmur3 Hash with seed=0:0x%08x\n", hashed); } diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index f2663dd0c0..68579d83f3 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -131,6 +131,7 @@ int cmd__parse_options(int argc, const char **argv) .short_name = 'B', .long_name = "no-fear", .value = &boolean, + .precision = sizeof(boolean), .help = "be brave", .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = 1, @@ -148,9 +149,16 @@ int cmd__parse_options(int argc, const char **argv) OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23), OPT_CMDMODE(0, "mode1", &integer, "set integer to 1 (cmdmode option)", 1), OPT_CMDMODE(0, "mode2", &integer, "set integer to 2 (cmdmode option)", 2), - OPT_CALLBACK_F(0, "mode34", &integer, "(3|4)", - "set integer to 3 or 4 (cmdmode option)", - PARSE_OPT_CMDMODE, mode34_callback), + { + .type = OPTION_CALLBACK, + .long_name = "mode34", + .value = &integer, + .precision = sizeof(integer), + .argh = "(3|4)", + .help = "set integer to 3 or 4 (cmdmode option)", + .flags = PARSE_OPT_CMDMODE, + .callback = mode34_callback, + }, OPT_CALLBACK('L', "length", &integer, "str", "get length of <str>", length_callback), OPT_FILENAME('F', "file", &file, "set file to <file>"), @@ -170,6 +178,7 @@ int cmd__parse_options(int argc, const char **argv) .type = OPTION_COUNTUP, .short_name = '+', .value = &boolean, + .precision = sizeof(boolean), .help = "same as -b", .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH, }, @@ -177,6 +186,7 @@ int cmd__parse_options(int argc, const char **argv) .type = OPTION_COUNTUP, .long_name = "ambiguous", .value = &ambiguous, + .precision = sizeof(ambiguous), .help = "positive ambiguity", .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, }, @@ -184,6 +194,7 @@ int cmd__parse_options(int argc, const char **argv) .type = OPTION_COUNTUP, .long_name = "no-ambiguous", .value = &ambiguous, + .precision = sizeof(ambiguous), .help = "negative ambiguity", .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, }, diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c index 6f10c5a435..6be0cdb8e2 100644 --- a/t/helper/test-string-list.c +++ b/t/helper/test-string-list.c @@ -1,105 +1,9 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "test-tool.h" #include "strbuf.h" #include "string-list.h" -/* - * Parse an argument into a string list. arg should either be a - * ':'-separated list of strings, or "-" to indicate an empty string - * list (as opposed to "", which indicates a string list containing a - * single empty string). list->strdup_strings must be set. - */ -static void parse_string_list(struct string_list *list, const char *arg) -{ - if (!strcmp(arg, "-")) - return; - - (void)string_list_split(list, arg, ':', -1); -} - -static void write_list(const struct string_list *list) -{ - int i; - for (i = 0; i < list->nr; i++) - printf("[%d]: \"%s\"\n", i, list->items[i].string); -} - -static void write_list_compact(const struct string_list *list) -{ - int i; - if (!list->nr) - printf("-\n"); - else { - printf("%s", list->items[0].string); - for (i = 1; i < list->nr; i++) - printf(":%s", list->items[i].string); - printf("\n"); - } -} - -static int prefix_cb(struct string_list_item *item, void *cb_data) -{ - const char *prefix = (const char *)cb_data; - return starts_with(item->string, prefix); -} - int cmd__string_list(int argc, const char **argv) { - if (argc == 5 && !strcmp(argv[1], "split")) { - struct string_list list = STRING_LIST_INIT_DUP; - int i; - const char *s = argv[2]; - int delim = *argv[3]; - int maxsplit = atoi(argv[4]); - - i = string_list_split(&list, s, delim, maxsplit); - printf("%d\n", i); - write_list(&list); - string_list_clear(&list, 0); - return 0; - } - - if (argc == 5 && !strcmp(argv[1], "split_in_place")) { - struct string_list list = STRING_LIST_INIT_NODUP; - int i; - char *s = xstrdup(argv[2]); - const char *delim = argv[3]; - int maxsplit = atoi(argv[4]); - - i = string_list_split_in_place(&list, s, delim, maxsplit); - printf("%d\n", i); - write_list(&list); - string_list_clear(&list, 0); - free(s); - return 0; - } - - if (argc == 4 && !strcmp(argv[1], "filter")) { - /* - * Retain only the items that have the specified prefix. - * Arguments: list|- prefix - */ - struct string_list list = STRING_LIST_INIT_DUP; - const char *prefix = argv[3]; - - parse_string_list(&list, argv[2]); - filter_string_list(&list, 0, prefix_cb, (void *)prefix); - write_list_compact(&list); - string_list_clear(&list, 0); - return 0; - } - - if (argc == 3 && !strcmp(argv[1], "remove_duplicates")) { - struct string_list list = STRING_LIST_INIT_DUP; - - parse_string_list(&list, argv[2]); - string_list_remove_duplicates(&list, 0); - write_list_compact(&list); - string_list_clear(&list, 0); - return 0; - } - if (argc == 2 && !strcmp(argv[1], "sort")) { struct string_list list = STRING_LIST_INIT_NODUP; struct strbuf sb = STRBUF_INIT; diff --git a/t/meson.build b/t/meson.build index 6d7fe6b117..660d780dcc 100644 --- a/t/meson.build +++ b/t/meson.build @@ -11,6 +11,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c', + 'unit-tests/u-string-list.c', 'unit-tests/u-strvec.c', 'unit-tests/u-trailer.c', 'unit-tests/u-urlmatch-normalization.c', @@ -123,7 +124,6 @@ integration_tests = [ 't0060-path-utils.sh', 't0061-run-command.sh', 't0062-revision-walking.sh', - 't0063-string-list.sh', 't0066-dir-iterator.sh', 't0067-parse_pathspec_file.sh', 't0068-for-each-repo.sh', @@ -1116,6 +1116,7 @@ benchmarks = [ 'perf/p1450-fsck.sh', 'perf/p1451-fsck-skip-list.sh', 'perf/p1500-graph-walks.sh', + 'perf/p1501-rev-parse-oneline.sh', 'perf/p2000-sparse-operations.sh', 'perf/p3400-rebase.sh', 'perf/p3404-rebase-interactive.sh', diff --git a/t/perf/p1501-rev-parse-oneline.sh b/t/perf/p1501-rev-parse-oneline.sh new file mode 100755 index 0000000000..538fa9c404 --- /dev/null +++ b/t/perf/p1501-rev-parse-oneline.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +test_description='Test :/ object name notation' + +. ./perf-lib.sh + +test_perf_fresh_repo + +# +# Creates lots of merges to make history traversal costly. In +# particular it creates 2^($max_level-1)-1 2-way merges on top of +# 2^($max_level-1) root commits. E.g., the commit history looks like +# this for a $max_level of 3: +# +# _1_ +# / \ +# 2 3 +# / \ / \ +# 4 5 6 7 +# +# The numbers are the fast-import marks, which also are the commit +# messages. 1 is the HEAD commit and a merge, 2 and 3 are also merges, +# 4-7 are the root commits. +# +build_history () { + local max_level="$1" && + local level="${2:-1}" && + local mark="${3:-1}" && + if test $level -eq $max_level + then + echo "reset refs/heads/master" && + echo "from $ZERO_OID" && + echo "commit refs/heads/master" && + echo "mark :$mark" && + echo "committer C <c@example.com> 1234567890 +0000" && + echo "data <<EOF" && + echo "$mark" && + echo "EOF" + else + local level1=$((level+1)) && + local mark1=$((2*mark)) && + local mark2=$((2*mark+1)) && + build_history $max_level $level1 $mark1 && + build_history $max_level $level1 $mark2 && + echo "commit refs/heads/master" && + echo "mark :$mark" && + echo "committer C <c@example.com> 1234567890 +0000" && + echo "data <<EOF" && + echo "$mark" && + echo "EOF" && + echo "from :$mark1" && + echo "merge :$mark2" + fi +} + +test_expect_success 'setup' ' + build_history 16 | git fast-import && + git log --format="%H %s" --reverse >commits && + sed -n -e "s/ .*$//p" -e "q" <commits >expect && + sed -n -e "s/^.* //p" -e "q" <commits >needle +' + +test_perf "rev-parse :/$(cat needle)" ' + git rev-parse :/$(cat needle) >actual +' + +test_expect_success 'verify result' ' + test_cmp expect actual +' + +test_done diff --git a/t/t0001-init.sh b/t/t0001-init.sh index f11a40811f..f593c53687 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -658,6 +658,17 @@ test_expect_success 'init warns about invalid init.defaultRefFormat' ' test_cmp expected actual ' +test_expect_success 'default ref format' ' + test_when_finished "rm -rf refformat" && + ( + sane_unset GIT_DEFAULT_REF_FORMAT && + git init refformat + ) && + git version --build-options | sed -ne "s/^default-ref-format: //p" >expect && + git -C refformat rev-parse --show-ref-format >actual && + test_cmp expect actual +' + backends="files reftable" for format in $backends do @@ -738,6 +749,40 @@ test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides init.defaultRefFormat" ' test_cmp expect actual ' +test_expect_success "init with feature.experimental=true" ' + test_when_finished "rm -rf refformat" && + test_config_global feature.experimental true && + ( + sane_unset GIT_DEFAULT_REF_FORMAT && + git init refformat + ) && + echo reftable >expect && + git -C refformat rev-parse --show-ref-format >actual && + test_cmp expect actual +' + +test_expect_success "init.defaultRefFormat overrides feature.experimental=true" ' + test_when_finished "rm -rf refformat" && + test_config_global feature.experimental true && + test_config_global init.defaultRefFormat files && + ( + sane_unset GIT_DEFAULT_REF_FORMAT && + git init refformat + ) && + echo files >expect && + git -C refformat rev-parse --show-ref-format >actual && + test_cmp expect actual +' + +test_expect_success "GIT_DEFAULT_REF_FORMAT= overrides feature.experimental=true" ' + test_when_finished "rm -rf refformat" && + test_config_global feature.experimental true && + GIT_DEFAULT_REF_FORMAT=files git init refformat && + echo files >expect && + git -C refformat rev-parse --show-ref-format >actual && + test_cmp expect actual +' + for from_format in $backends do test_expect_success "re-init with same format ($from_format)" ' diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh deleted file mode 100755 index aac63ba506..0000000000 --- a/t/t0063-string-list.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2012 Michael Haggerty -# - -test_description='Test string list functionality' - -. ./test-lib.sh - -test_split () { - cat >expected && - test_expect_success "split $1 at $2, max $3" " - test-tool string-list split '$1' '$2' '$3' >actual && - test_cmp expected actual && - test-tool string-list split_in_place '$1' '$2' '$3' >actual && - test_cmp expected actual - " -} - -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" -[1]: "bar" -[2]: "baz" -EOF - -test_split "foo:bar:baz" ":" "0" <<EOF -1 -[0]: "foo:bar:baz" -EOF - -test_split "foo:bar:baz" ":" "1" <<EOF -2 -[0]: "foo" -[1]: "bar:baz" -EOF - -test_split "foo:bar:baz" ":" "2" <<EOF -3 -[0]: "foo" -[1]: "bar" -[2]: "baz" -EOF - -test_split "foo:bar:" ":" "-1" <<EOF -3 -[0]: "foo" -[1]: "bar" -[2]: "" -EOF - -test_split "" ":" "-1" <<EOF -1 -[0]: "" -EOF - -test_split ":" ":" "-1" <<EOF -2 -[0]: "" -[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)" && - test yes = "$(test-tool string-list filter yes y)" && - test yes = "$(test-tool string-list filter no:yes y)" && - test yes = "$(test-tool string-list filter yes:no y)" && - test y1:y2 = "$(test-tool string-list filter y1:y2 y)" && - test y2:y1 = "$(test-tool string-list filter y2:y1 y)" && - test "x-" = "x$(test-tool string-list filter x1:x2 y)" -' - -test_expect_success "test remove_duplicates" ' - test "x-" = "x$(test-tool string-list remove_duplicates -)" && - test "x" = "x$(test-tool string-list remove_duplicates "")" && - test a = "$(test-tool string-list remove_duplicates a)" && - test a = "$(test-tool string-list remove_duplicates a:a)" && - test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" && - test a:b = "$(test-tool string-list remove_duplicates a:b)" && - test a:b = "$(test-tool string-list remove_duplicates a:a:b)" && - test a:b = "$(test-tool string-list remove_duplicates a:b:b)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" && - test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)" -' - -test_done diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index f123ef1e36..1f61b666a7 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -197,7 +197,7 @@ $content" # FIXME: %(rest) is incompatible with object names that include whitespace, # e.g. HEAD:path/to/a/file with spaces. Use the resolved OID as input to # test this instead of the raw object name. - if echo "$object_name" | grep " "; then + if echo "$object_name" | grep -q " "; then test_rest=test_expect_failure else test_rest=test_expect_success diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index 64658b3ba5..de076293b6 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -252,9 +252,9 @@ test_expect_success '--literally complains about non-standard types' ' test_must_fail git hash-object -t bogus --literally --stdin ' -test_expect_success '--stdin outside of repository (uses SHA-1)' ' +test_expect_success '--stdin outside of repository (uses default hash)' ' nongit git hash-object --stdin <hello >actual && - echo "$(test_oid --hash=sha1 hello)" >expect && + echo "$(test_oid --hash=builtin hello)" >expect && test_cmp expect actual ' diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 7359af02a2..96648a6e5d 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -2349,4 +2349,23 @@ test_expect_success 'update-ref should also create reflog for HEAD' ' test_cmp expect actual ' +test_expect_success REFFILES 'empty directories are pruned when aborting a transaction' ' + test_path_is_missing .git/refs/heads/nested && + git update-ref --stdin <<-EOF && + create refs/heads/nested/something HEAD + prepare + abort + EOF + test_path_is_missing .git/refs/heads/nested +' + +test_expect_success REFFILES 'empty directories are pruned when not committing' ' + test_path_is_missing .git/refs/heads/nested && + git update-ref --stdin <<-EOF && + create refs/heads/nested/something HEAD + prepare + EOF + test_path_is_missing .git/refs/heads/nested +' + test_done diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh index 6824581317..8f59b867f2 100755 --- a/t/t1517-outside-repo.sh +++ b/t/t1517-outside-repo.sh @@ -114,4 +114,11 @@ test_expect_success 'update-server-info does not crash with -h' ' test_grep "[Uu]sage: git update-server-info " usage ' +test_expect_success 'prune does not crash with -h' ' + test_expect_code 129 git prune -h >usage && + test_grep "[Uu]sage: git prune " usage && + test_expect_code 129 nongit git prune -h >usage && + test_grep "[Uu]sage: git prune " usage +' + test_done diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index 127216f722..b8a8dd77e7 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -328,6 +328,19 @@ test_expect_success 'there is no --no-reschedule-failed-exec in an ongoing rebas test_expect_code 129 git rebase --edit-todo --no-reschedule-failed-exec ' +test_expect_success 'no change in comment character due to conflicts markers with core.commentChar=auto' ' + git checkout -b branch-a && + test_commit A F1 && + git checkout -b branch-b HEAD^ && + test_commit B F1 && + test_must_fail git rebase branch-a && + printf "B\nA\n" >F1 && + git add F1 && + GIT_EDITOR="cat >actual" git -c core.commentChar=auto rebase --continue && + # Check that "#" is still the comment character. + test_grep "^# Changes to be committed" actual +' + test_orig_head_helper () { test_when_finished 'git rebase --abort && git checkout topic && diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index c58ccb136c..0bb4648e36 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -1672,11 +1672,9 @@ test_expect_success 'stash create reports a locked index' ' echo change >A.file && touch .git/index.lock && - cat >expect <<-EOF && - error: could not write index - EOF test_must_fail git stash create 2>err && - test_cmp expect err + test_grep "error: could not write index" err && + test_grep "error: Unable to create '.*index.lock'" err ) ' @@ -1689,11 +1687,9 @@ test_expect_success 'stash push reports a locked index' ' echo change >A.file && touch .git/index.lock && - cat >expect <<-EOF && - error: could not write index - EOF test_must_fail git stash push 2>err && - test_cmp expect err + test_grep "error: could not write index" err && + test_grep "error: Unable to create '.*index.lock'" err ) ' @@ -1707,11 +1703,9 @@ test_expect_success 'stash apply reports a locked index' ' git stash push && touch .git/index.lock && - cat >expect <<-EOF && - error: could not write index - EOF test_must_fail git stash apply 2>err && - test_cmp expect err + test_grep "error: could not write index" err && + test_grep "error: Unable to create '.*index.lock'" err ) ' diff --git a/t/t4042-diff-textconv-caching.sh b/t/t4042-diff-textconv-caching.sh index ff0e73531b..31018ceba2 100755 --- a/t/t4042-diff-textconv-caching.sh +++ b/t/t4042-diff-textconv-caching.sh @@ -120,6 +120,14 @@ test_expect_success 'log notes cache and still use cache for -p' ' ' test_expect_success 'caching is silently ignored outside repo' ' + test_oid_cache <<-\EOM && + oid1 sha1:5626abf + oid1 sha256:a4ed1f3 + oid2 sha1:f719efd + oid2 sha256:aa9e7dc + EOM + oid1=$(test_oid --hash=builtin oid1) && + oid2=$(test_oid --hash=builtin oid2) && mkdir -p non-repo && echo one >non-repo/one && echo two >non-repo/two && @@ -129,9 +137,9 @@ test_expect_success 'caching is silently ignored outside repo' ' -c diff.test.textconv="tr a-z A-Z <" \ -c diff.test.cachetextconv=true \ diff --no-index one two >actual && - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/one b/two - index 5626abf..f719efd 100644 + index $oid1..$oid2 100644 --- a/one +++ b/two @@ -1 +1 @@ diff --git a/t/t4140-apply-ita.sh b/t/t4140-apply-ita.sh index c614eaf04c..0b11a8aef4 100755 --- a/t/t4140-apply-ita.sh +++ b/t/t4140-apply-ita.sh @@ -7,6 +7,10 @@ test_description='git apply of i-t-a file' test_expect_success setup ' test_write_lines 1 2 3 4 5 >blueprint && + cat blueprint >committed-file && + git add committed-file && + git commit -m "commit" && + cat blueprint >test-file && git add -N test-file && git diff >creation-patch && @@ -14,7 +18,14 @@ test_expect_success setup ' rm -f test-file && git diff >deletion-patch && - grep "deleted file mode 100644" deletion-patch + grep "deleted file mode 100644" deletion-patch && + + git rm -f test-file && + test_write_lines 6 >>committed-file && + cat blueprint >test-file && + git add -N test-file && + git diff >complex-patch && + git restore committed-file ' test_expect_success 'apply creation patch to ita path (--cached)' ' @@ -53,4 +64,22 @@ test_expect_success 'apply deletion patch to ita path (--index)' ' git ls-files --stage --error-unmatch test-file ' +test_expect_success 'apply creation patch to existing index with -N' ' + git rm -f test-file && + cat blueprint >index-file && + git add index-file && + git apply -N creation-patch && + + git ls-files --stage --error-unmatch index-file && + git ls-files --stage --error-unmatch test-file +' + +test_expect_success 'apply complex patch with -N' ' + git rm -f test-file index-file && + git apply -N complex-patch && + + git ls-files --stage --error-unmatch test-file && + git diff | grep "a/committed-file" +' + test_done diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 2ae93d3c96..699a81ab5c 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -1086,7 +1086,7 @@ test_expect_success 'am works with multi-line in-body headers' ' # bump from, date, and subject down to in-body header awk " /^From:/{ - print \"From: x <x\@example.com>\"; + print \"From: x <x@example.com>\"; print \"Date: Sat, 1 Jan 2000 00:00:00 +0000\"; print \"Subject: x\n\"; }; 1 diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 4a6c4dfbf4..05cee9e41b 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -134,6 +134,12 @@ test_expect_success 'diff-filter=D' ' ' +test_expect_success 'all-negative filter' ' + git log --no-renames --format=%s --diff-filter=d HEAD >actual && + printf "%s\n" fifth fourth third second initial >expect && + test_cmp expect actual +' + test_expect_success 'diff-filter=R' ' git log -M --pretty="format:%s" --diff-filter=R HEAD >actual && diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh index 8910d53cac..639868ac56 100755 --- a/t/t4216-log-bloom.sh +++ b/t/t4216-log-bloom.sh @@ -66,8 +66,9 @@ sane_unset GIT_TRACE2_CONFIG_PARAMS setup () { rm -f "$TRASH_DIRECTORY/trace.perf" && - git -c core.commitGraph=false log --pretty="format:%s" $1 >log_wo_bloom && - GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace.perf" git -c core.commitGraph=true log --pretty="format:%s" $1 >log_w_bloom + eval git -c core.commitGraph=false log --pretty="format:%s" "$1" >log_wo_bloom && + eval "GIT_TRACE2_PERF=\"$TRASH_DIRECTORY/trace.perf\"" \ + git -c core.commitGraph=true log --pretty="format:%s" "$1" >log_w_bloom } test_bloom_filters_used () { @@ -138,10 +139,6 @@ test_expect_success 'git log with --walk-reflogs does not use Bloom filters' ' test_bloom_filters_not_used "--walk-reflogs -- A" ' -test_expect_success 'git log -- multiple path specs does not use Bloom filters' ' - test_bloom_filters_not_used "-- file4 A/file1" -' - test_expect_success 'git log -- "." pathspec at root does not use Bloom filters' ' test_bloom_filters_not_used "-- ." ' @@ -151,9 +148,17 @@ test_expect_success 'git log with wildcard that resolves to a single path uses B test_bloom_filters_used "-- *renamed" ' -test_expect_success 'git log with wildcard that resolves to a multiple paths does not uses Bloom filters' ' - test_bloom_filters_not_used "-- *" && - test_bloom_filters_not_used "-- file*" +test_expect_success 'git log with multiple literal paths uses Bloom filter' ' + test_bloom_filters_used "-- file4 A/file1" && + test_bloom_filters_used "-- *" && + test_bloom_filters_used "-- file*" +' + +test_expect_success 'git log with path contains a wildcard does not use Bloom filter' ' + test_bloom_filters_not_used "-- file\*" && + test_bloom_filters_not_used "-- A/\* file4" && + test_bloom_filters_not_used "-- file4 A/\*" && + test_bloom_filters_not_used "-- * A/\*" ' test_expect_success 'setup - add commit-graph to the chain without Bloom filters' ' diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index ae72158b94..73445782e7 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -525,7 +525,7 @@ test_expect_success 'index-pack --strict <pack> works in non-repo' ' test_path_is_file foo.idx ' -test_expect_success SHA1 'show-index works OK outside a repository' ' +test_expect_success DEFAULT_HASH_ALGORITHM 'show-index works OK outside a repository' ' nongit git show-index <foo.idx ' @@ -658,7 +658,7 @@ do test_commit -C repo initial && git -C repo repack -ad && git -C repo verify-pack "$(pwd)"/repo/.git/objects/pack/*.idx && - if test $hash = sha1 + if test $hash = $GIT_TEST_BUILTIN_HASH then nongit git verify-pack "$(pwd)"/repo/.git/objects/pack/*.idx else @@ -676,7 +676,7 @@ do test_commit -C repo initial && git -C repo repack -ad && git -C repo index-pack --verify "$(pwd)"/repo/.git/objects/pack/*.pack && - if test $hash = sha1 + if test $hash = $GIT_TEST_BUILTIN_HASH then nongit git index-pack --verify "$(pwd)"/repo/.git/objects/pack/*.pack else diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index b6926f1027..6718fb98c0 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -495,6 +495,36 @@ test_bitmap_cases () { grep "ignoring extra bitmap" trace2.txt ) ' + + test_expect_success 'load corrupt bitmap' ' + rm -fr repo && + git init repo && + test_when_finished "rm -fr repo" && + ( + cd repo && + git config pack.writeBitmapLookupTable '"$writeLookupTable"' && + + test_commit base && + + git repack -adb && + bitmap="$(ls .git/objects/pack/pack-*.bitmap)" && + chmod +w $bitmap && + + test-tool bitmap list-commits-with-offset >offsets && + xor_off=$(head -n1 offsets | awk "{print \$3}") && + printf '\161' | + dd of=$bitmap count=1 bs=1 conv=notrunc seek=$xor_off && + + git rev-list --objects --no-object-names HEAD >expect.raw && + git rev-list --objects --use-bitmap-index --no-object-names HEAD \ + >actual.raw && + + sort expect.raw >expect && + sort actual.raw >actual && + + test_cmp expect actual + ) + ' } test_bitmap_cases diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index ba5ae6a00c..1f7a5d82ee 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -234,8 +234,8 @@ test_expect_success 'pseudo-merge pattern with capture groups' ' test_commit_bulk 16 && git rev-list HEAD~16.. >in && - sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1" in | - git update-ref --stdin || return 1 + sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1|" in >refs && + git update-ref --stdin <refs || return 1 done && git \ diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index bef0250e89..2701eef85e 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -1644,4 +1644,18 @@ test_expect_success 'empty config clears remote.*.pushurl list' ' test_cmp expect actual ' +test_expect_success 'forbid adding subset of existing remote' ' + test_when_finished "git remote rm outer" && + git remote add outer url && + test_must_fail git remote add outer/inner url 2>err && + test_grep ".outer/inner. is a subset of existing remote .outer." err +' + +test_expect_success 'forbid adding superset of existing remote' ' + test_when_finished "git remote rm outer/inner" && + git remote add outer/inner url && + test_must_fail git remote add outer url 2>err && + test_grep ".outer. is a superset of existing remote .outer/inner." err +' + test_done diff --git a/t/t7528-signed-commit-ssh.sh b/t/t7528-signed-commit-ssh.sh index 065f780636..0f887a3ebe 100755 --- a/t/t7528-signed-commit-ssh.sh +++ b/t/t7528-signed-commit-ssh.sh @@ -84,18 +84,26 @@ test_expect_success GPGSSH 'sign commits using literal public keys with ssh-agen test_config gpg.format ssh && eval $(ssh-agent) && test_when_finished "kill ${SSH_AGENT_PID}" && - ssh-add "${GPGSSH_KEY_PRIMARY}" && - echo 1 >file && git add file && - git commit -a -m rsa-inline -S"$(cat "${GPGSSH_KEY_PRIMARY}.pub")" && - echo 2 >file && - test_config user.signingkey "$(cat "${GPGSSH_KEY_PRIMARY}.pub")" && - git commit -a -m rsa-config -S && - ssh-add "${GPGSSH_KEY_ECDSA}" && - echo 3 >file && - git commit -a -m ecdsa-inline -S"key::$(cat "${GPGSSH_KEY_ECDSA}.pub")" && - echo 4 >file && - test_config user.signingkey "key::$(cat "${GPGSSH_KEY_ECDSA}.pub")" && - git commit -a -m ecdsa-config -S + test_when_finished "test_unconfig user.signingkey" && + mkdir tmpdir && + TMPDIR="$(pwd)/tmpdir" && + ( + export TMPDIR && + ssh-add "${GPGSSH_KEY_PRIMARY}" && + echo 1 >file && git add file && + git commit -a -m rsa-inline -S"$(cat "${GPGSSH_KEY_PRIMARY}.pub")" && + echo 2 >file && + git config user.signingkey "$(cat "${GPGSSH_KEY_PRIMARY}.pub")" && + git commit -a -m rsa-config -S && + ssh-add "${GPGSSH_KEY_ECDSA}" && + echo 3 >file && + git commit -a -m ecdsa-inline -S"key::$(cat "${GPGSSH_KEY_ECDSA}.pub")" && + echo 4 >file && + git config user.signingkey "key::$(cat "${GPGSSH_KEY_ECDSA}.pub")" && + git commit -a -m ecdsa-config -S + ) && + find tmpdir -type f >tmpfiles && + test_must_be_empty tmpfiles ' test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'create signed commits with keys having defined lifetimes' ' diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 0c1af43f6f..e56e0c8d77 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -201,6 +201,13 @@ test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' ' test_cmp expected-cc commandline1 ' +test_expect_failure $PREREQ 'invalid smtp server port value' ' + clean_fake_sendmail && + git send-email -1 --to=recipient@example.com \ + --smtp-server-port=bogus-symbolic-name \ + --smtp-server="$(pwd)/fake.sendmail" +' + test_expect_success $PREREQ 'setup expect' " cat >expected-show-all-headers <<\EOF 0001-Second.patch diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index 76619765fc..46700dbc40 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -314,7 +314,7 @@ test_expect_success GPG 'signed-commits=abort' ' test_expect_success GPG 'signed-commits=verbatim' ' git fast-export --signed-commits=verbatim --reencode=no commit-signing >output && - grep "^gpgsig sha" output && + test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output && grep "encoding ISO-8859-1" output && ( cd new && @@ -328,7 +328,7 @@ test_expect_success GPG 'signed-commits=verbatim' ' test_expect_success GPG 'signed-commits=warn-verbatim' ' git fast-export --signed-commits=warn-verbatim --reencode=no commit-signing >output 2>err && - grep "^gpgsig sha" output && + test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output && grep "encoding ISO-8859-1" output && test -s err && ( @@ -369,6 +369,62 @@ test_expect_success GPG 'signed-commits=warn-strip' ' ' +test_expect_success GPGSM 'setup X.509 signed commit' ' + + git checkout -b x509-signing main && + test_config gpg.format x509 && + test_config user.signingkey $GIT_COMMITTER_EMAIL && + echo "X.509 content" >file && + git add file && + git commit -S -m "X.509 signed commit" && + X509_COMMIT=$(git rev-parse HEAD) && + git checkout main + +' + +test_expect_success GPGSM 'round-trip X.509 signed commit' ' + + git fast-export --signed-commits=verbatim x509-signing >output && + test_grep -E "^gpgsig $GIT_DEFAULT_HASH x509" output && + ( + cd new && + git fast-import && + git cat-file commit refs/heads/x509-signing >actual && + grep "^gpgsig" actual && + IMPORTED=$(git rev-parse refs/heads/x509-signing) && + test $X509_COMMIT = $IMPORTED + ) <output + +' + +test_expect_success GPGSSH 'setup SSH signed commit' ' + + git checkout -b ssh-signing main && + test_config gpg.format ssh && + test_config user.signingkey "${GPGSSH_KEY_PRIMARY}" && + echo "SSH content" >file && + git add file && + git commit -S -m "SSH signed commit" && + SSH_COMMIT=$(git rev-parse HEAD) && + git checkout main + +' + +test_expect_success GPGSSH 'round-trip SSH signed commit' ' + + git fast-export --signed-commits=verbatim ssh-signing >output && + test_grep -E "^gpgsig $GIT_DEFAULT_HASH ssh" output && + ( + cd new && + git fast-import && + git cat-file commit refs/heads/ssh-signing >actual && + grep "^gpgsig" actual && + IMPORTED=$(git rev-parse refs/heads/ssh-signing) && + test $SSH_COMMIT = $IMPORTED + ) <output + +' + test_expect_success 'setup submodule' ' test_config_global protocol.file.allow always && @@ -905,4 +961,46 @@ test_expect_success 'fast-export handles --end-of-options' ' test_cmp expect actual ' +test_expect_success GPG 'setup a commit with dual signatures on its SHA-1 and SHA-256 formats' ' + # Create a signed SHA-256 commit + git init --object-format=sha256 explicit-sha256 && + git -C explicit-sha256 config extensions.compatObjectFormat sha1 && + git -C explicit-sha256 checkout -b dual-signed && + test_commit -C explicit-sha256 A && + echo B >explicit-sha256/B && + git -C explicit-sha256 add B && + test_tick && + git -C explicit-sha256 commit -S -m "signed" B && + SHA256_B=$(git -C explicit-sha256 rev-parse dual-signed) && + + # Create the corresponding SHA-1 commit + SHA1_B=$(git -C explicit-sha256 rev-parse --output-object-format=sha1 dual-signed) && + + # Check that the resulting SHA-1 commit has both signatures + echo $SHA1_B | git -C explicit-sha256 cat-file --batch >out && + test_grep -E "^gpgsig " out && + test_grep -E "^gpgsig-sha256 " out +' + +test_expect_success GPG 'export and import of doubly signed commit' ' + git -C explicit-sha256 fast-export --signed-commits=verbatim dual-signed >output && + test_grep -E "^gpgsig sha1 openpgp" output && + test_grep -E "^gpgsig sha256 openpgp" output && + + ( + cd new && + git fast-import && + git cat-file commit refs/heads/dual-signed >actual && + test_grep -E "^gpgsig " actual && + test_grep -E "^gpgsig-sha256 " actual && + IMPORTED=$(git rev-parse refs/heads/dual-signed) && + if test "$GIT_DEFAULT_HASH" = "sha1" + then + test $SHA1_B = $IMPORTED + else + test $SHA256_B = $IMPORTED + fi + ) <output +' + test_done diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 6230746cc4..a28de7b19b 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1707,7 +1707,7 @@ test_set_hash () { # Detect the hash algorithm in use. test_detect_hash () { - case "$GIT_TEST_DEFAULT_HASH" in + case "${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}" in "sha256") test_hash_algo=sha256 test_compat_hash_algo=sha1 @@ -1779,6 +1779,9 @@ test_oid () { --hash=compat) algo="$test_compat_hash_algo" && shift;; + --hash=builtin) + algo="$GIT_TEST_BUILTIN_HASH" && + shift;; --hash=*) algo="${1#--hash=}" && shift;; diff --git a/t/test-lib.sh b/t/test-lib.sh index 51370a201c..621cd31ae1 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -134,7 +134,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME ################################################################ # It appears that people try to run tests without building... -"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null +GIT_BINARY="${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" +"$GIT_BINARY" >/dev/null if test $? != 1 then if test -n "$GIT_TEST_INSTALLED" @@ -536,7 +537,8 @@ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME export GIT_COMMITTER_DATE GIT_AUTHOR_DATE export EDITOR -GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-sha1}" +GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p') +GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}" export GIT_DEFAULT_HASH GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}" export GIT_DEFAULT_REF_FORMAT @@ -1908,6 +1910,10 @@ test_lazy_prereq SHA1 ' esac ' +test_lazy_prereq DEFAULT_HASH_ALGORITHM ' + test "$GIT_TEST_BUILTIN_HASH" = "$GIT_DEFAULT_HASH" +' + test_lazy_prereq DEFAULT_REPO_FORMAT ' test_have_prereq SHA1,REFFILES ' diff --git a/t/unit-tests/u-prio-queue.c b/t/unit-tests/u-prio-queue.c index 145e689c9c..63e58114ae 100644 --- a/t/unit-tests/u-prio-queue.c +++ b/t/unit-tests/u-prio-queue.c @@ -13,6 +13,7 @@ static int intcmp(const void *va, const void *vb, void *data UNUSED) #define STACK -3 #define GET -4 #define REVERSE -5 +#define REPLACE -6 static int show(int *v) { @@ -51,6 +52,15 @@ static void test_prio_queue(int *input, size_t input_size, case REVERSE: prio_queue_reverse(&pq); break; + case REPLACE: + peek = prio_queue_peek(&pq); + cl_assert(i + 1 < input_size); + cl_assert(input[i + 1] >= 0); + cl_assert(j < result_size); + cl_assert_equal_i(result[j], show(peek)); + j++; + prio_queue_replace(&pq, &input[++i]); + break; default: prio_queue_put(&pq, &input[i]); break; @@ -81,6 +91,13 @@ void test_prio_queue__empty(void) ((int []){ 1, 2, MISSING, 1, 2, MISSING })); } +void test_prio_queue__replace(void) +{ + TEST_INPUT(((int []){ REPLACE, 6, 2, 4, REPLACE, 5, 7, GET, + REPLACE, 1, DUMP }), + ((int []){ MISSING, 2, 4, 5, 1, 6, 7 })); +} + void test_prio_queue__stack(void) { TEST_INPUT(((int []){ STACK, 8, 1, 5, 4, 6, 2, 3, DUMP }), @@ -92,3 +109,9 @@ void test_prio_queue__reverse_stack(void) TEST_INPUT(((int []){ STACK, 1, 2, 3, 4, 5, 6, REVERSE, DUMP }), ((int []){ 1, 2, 3, 4, 5, 6 })); } + +void test_prio_queue__replace_stack(void) +{ + TEST_INPUT(((int []){ STACK, 8, 1, 5, REPLACE, 4, 6, 2, 3, DUMP }), + ((int []){ 5, 3, 2, 6, 4, 1, 8 })); +} diff --git a/t/unit-tests/u-string-list.c b/t/unit-tests/u-string-list.c new file mode 100644 index 0000000000..d4ba5f9fa5 --- /dev/null +++ b/t/unit-tests/u-string-list.c @@ -0,0 +1,227 @@ +#include "unit-test.h" +#include "string-list.h" + +static void t_vcreate_string_list_dup(struct string_list *list, + int free_util, va_list ap) +{ + const char *arg; + + cl_assert(list->strdup_strings); + + string_list_clear(list, free_util); + while ((arg = va_arg(ap, const char *))) + string_list_append(list, arg); +} + +static void t_create_string_list_dup(struct string_list *list, int free_util, ...) +{ + va_list ap; + + cl_assert(list->strdup_strings); + + string_list_clear(list, free_util); + va_start(ap, free_util); + t_vcreate_string_list_dup(list, free_util, ap); + va_end(ap); +} + +static void t_string_list_clear(struct string_list *list, int free_util) +{ + string_list_clear(list, free_util); + cl_assert_equal_p(list->items, NULL); + cl_assert_equal_i(list->nr, 0); + cl_assert_equal_i(list->alloc, 0); +} + +static void t_string_list_equal(struct string_list *list, + struct string_list *expected_strings) +{ + cl_assert_equal_i(list->nr, expected_strings->nr); + cl_assert(list->nr <= list->alloc); + for (size_t i = 0; i < expected_strings->nr; i++) + cl_assert_equal_s(list->items[i].string, + expected_strings->items[i].string); +} + +static void t_string_list_split(const char *data, int delim, int maxsplit, ...) +{ + struct string_list expected_strings = STRING_LIST_INIT_DUP; + struct string_list list = STRING_LIST_INIT_DUP; + va_list ap; + int len; + + va_start(ap, maxsplit); + t_vcreate_string_list_dup(&expected_strings, 0, ap); + va_end(ap); + + string_list_clear(&list, 0); + len = string_list_split(&list, data, delim, maxsplit); + cl_assert_equal_i(len, expected_strings.nr); + t_string_list_equal(&list, &expected_strings); + + string_list_clear(&expected_strings, 0); + string_list_clear(&list, 0); +} + +void test_string_list__split(void) +{ + t_string_list_split("foo:bar:baz", ':', -1, "foo", "bar", "baz", NULL); + t_string_list_split("foo:bar:baz", ':', 0, "foo:bar:baz", NULL); + t_string_list_split("foo:bar:baz", ':', 1, "foo", "bar:baz", NULL); + t_string_list_split("foo:bar:baz", ':', 2, "foo", "bar", "baz", NULL); + t_string_list_split("foo:bar:", ':', -1, "foo", "bar", "", NULL); + t_string_list_split("", ':', -1, "", NULL); + t_string_list_split(":", ':', -1, "", "", NULL); +} + +static void t_string_list_split_in_place(const char *data, const char *delim, + int maxsplit, ...) +{ + struct string_list expected_strings = STRING_LIST_INIT_DUP; + struct string_list list = STRING_LIST_INIT_NODUP; + char *string = xstrdup(data); + va_list ap; + int len; + + va_start(ap, maxsplit); + t_vcreate_string_list_dup(&expected_strings, 0, ap); + va_end(ap); + + string_list_clear(&list, 0); + len = string_list_split_in_place(&list, string, delim, maxsplit); + cl_assert_equal_i(len, expected_strings.nr); + t_string_list_equal(&list, &expected_strings); + + free(string); + string_list_clear(&expected_strings, 0); + string_list_clear(&list, 0); +} + +void test_string_list__split_in_place(void) +{ + t_string_list_split_in_place("foo:;:bar:;:baz:;:", ":;", -1, + "foo", "", "", "bar", "", "", "baz", "", "", "", NULL); + t_string_list_split_in_place("foo:;:bar:;:baz", ":;", 0, + "foo:;:bar:;:baz", NULL); + t_string_list_split_in_place("foo:;:bar:;:baz", ":;", 1, + "foo", ";:bar:;:baz", NULL); + t_string_list_split_in_place("foo:;:bar:;:baz", ":;", 2, + "foo", "", ":bar:;:baz", NULL); + t_string_list_split_in_place("foo:;:bar:;:", ":;", -1, + "foo", "", "", "bar", "", "", "", NULL); +} + +static int prefix_cb(struct string_list_item *item, void *cb_data) +{ + const char *prefix = (const char *)cb_data; + return starts_with(item->string, prefix); +} + +static void t_string_list_filter(struct string_list *list, ...) +{ + struct string_list expected_strings = STRING_LIST_INIT_DUP; + const char *prefix = "y"; + va_list ap; + + va_start(ap, list); + t_vcreate_string_list_dup(&expected_strings, 0, ap); + va_end(ap); + + filter_string_list(list, 0, prefix_cb, (void *)prefix); + t_string_list_equal(list, &expected_strings); + + string_list_clear(&expected_strings, 0); +} + +void test_string_list__filter(void) +{ + struct string_list list = STRING_LIST_INIT_DUP; + + t_create_string_list_dup(&list, 0, NULL); + t_string_list_filter(&list, NULL); + + t_create_string_list_dup(&list, 0, "no", NULL); + t_string_list_filter(&list, NULL); + + t_create_string_list_dup(&list, 0, "yes", NULL); + t_string_list_filter(&list, "yes", NULL); + + t_create_string_list_dup(&list, 0, "no", "yes", NULL); + t_string_list_filter(&list, "yes", NULL); + + t_create_string_list_dup(&list, 0, "yes", "no", NULL); + t_string_list_filter(&list, "yes", NULL); + + t_create_string_list_dup(&list, 0, "y1", "y2", NULL); + t_string_list_filter(&list, "y1", "y2", NULL); + + t_create_string_list_dup(&list, 0, "y2", "y1", NULL); + t_string_list_filter(&list, "y2", "y1", NULL); + + t_create_string_list_dup(&list, 0, "x1", "x2", NULL); + t_string_list_filter(&list, NULL); + + t_string_list_clear(&list, 0); +} + +static void t_string_list_remove_duplicates(struct string_list *list, ...) +{ + struct string_list expected_strings = STRING_LIST_INIT_DUP; + va_list ap; + + va_start(ap, list); + t_vcreate_string_list_dup(&expected_strings, 0, ap); + va_end(ap); + + string_list_remove_duplicates(list, 0); + t_string_list_equal(list, &expected_strings); + + string_list_clear(&expected_strings, 0); +} + +void test_string_list__remove_duplicates(void) +{ + struct string_list list = STRING_LIST_INIT_DUP; + + t_create_string_list_dup(&list, 0, NULL); + t_string_list_remove_duplicates(&list, NULL); + + t_create_string_list_dup(&list, 0, "", NULL); + t_string_list_remove_duplicates(&list, "", NULL); + + t_create_string_list_dup(&list, 0, "a", NULL); + t_string_list_remove_duplicates(&list, "a", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", NULL); + t_string_list_remove_duplicates(&list, "a", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", "a", NULL); + t_string_list_remove_duplicates(&list, "a", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", "b", NULL); + t_string_list_remove_duplicates(&list, "a", "b", NULL); + + t_create_string_list_dup(&list, 0, "a", "b", "b", NULL); + t_string_list_remove_duplicates(&list, "a", "b", NULL); + + t_create_string_list_dup(&list, 0, "a", "b", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", "b", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_create_string_list_dup(&list, 0, "a", "b", "b", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_create_string_list_dup(&list, 0, "a", "b", "c", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", "b", "b", "c", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_create_string_list_dup(&list, 0, "a", "a", "a", "b", "b", "b", + "c", "c", "c", NULL); + t_string_list_remove_duplicates(&list, "a", "b", "c", NULL); + + t_string_list_clear(&list, 0); +} diff --git a/transport.c b/transport.c index 6c2801bcbd..c123ac1e38 100644 --- a/transport.c +++ b/transport.c @@ -1243,7 +1243,7 @@ struct transport *transport_get(struct remote *remote, const char *url) ret->smart_options->receivepack = remote->receivepack; } - ret->hash_algo = &hash_algos[GIT_HASH_SHA1]; + ret->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY]; return ret; } @@ -14,6 +14,7 @@ #include "blob.h" #include "refs.h" #include "progress.h" +#include "prio-queue.h" static struct object_id current_commit_oid; @@ -78,7 +79,7 @@ static int process_tree(struct walker *walker, struct tree *tree) #define SEEN (1U << 1) #define TO_SCAN (1U << 2) -static struct commit_list *complete = NULL; +static struct prio_queue complete = { compare_commits_by_commit_date }; static int process_commit(struct walker *walker, struct commit *commit) { @@ -87,7 +88,10 @@ static int process_commit(struct walker *walker, struct commit *commit) if (repo_parse_commit(the_repository, commit)) return -1; - while (complete && complete->item->date >= commit->date) { + while (complete.nr) { + struct commit *item = prio_queue_peek(&complete); + if (item->date < commit->date) + break; pop_most_recent_commit(&complete, COMPLETE); } @@ -233,7 +237,7 @@ static int mark_complete(const char *path UNUSED, if (commit) { commit->object.flags |= COMPLETE; - commit_list_insert(commit, &complete); + prio_queue_put(&complete, commit); } return 0; } @@ -302,7 +306,6 @@ int walker_fetch(struct walker *walker, int targets, char **target, if (!walker->get_recover) { refs_for_each_ref(get_main_ref_store(the_repository), mark_complete, NULL); - commit_list_sort_by_date(&complete); } for (i = 0; i < targets; i++) { |
