Git 2.41 source control system available

After three months of development, the release of the distributed source control system Git 2.41 has been published. Git is one of the most popular, reliable, and high-performance version control systems that provides flexible non-linear development tools based on branching and merging branches. To ensure the integrity of the history and resistance to retroactive changes, implicit hashing of the entire previous history in each commit is used, it is also possible to verify individual tags and commits with digital signatures from the developers.

Compared to the previous release, 542 changes were accepted into the new version, prepared with the participation of 95 developers, of which 29 took part in the development for the first time. Main innovations:

  • Improved handling of unreachable objects that are not referenced in the repository (branches or tags are not referenced). Unreachable objects are removed by the garbage collector, but remain in the repository for a certain time before removal to avoid race conditions. To keep track of the period of unreachable objects, it is necessary to bind labels to them with the change time of similar objects, which does not allow storing them in one pack-file, in which all objects have a common change time. Previously, each unreachable object was stored in a separate file, which led to problems if there were a large number of fresh unreachable objects that were not yet subject to deletion. In the new release, by default, the β€œcruft packs” mechanism is used to pack unreachable objects, which allows storing all unreachable objects in one pack file, and reflecting the data on the modification time of each object in a separate table stored in a file with the β€œ.mtimes” extension and linked using an index file with the ".idx" extension.
    Git 2.41 source control system available
  • By default, maintaining a reverse index (revindex) on disk for pack files is enabled. When tested on the torvalds/linux repositories, the use of a reverse index allowed us to speed up resource-intensive "git push" operations by 1.49 times, and simple operations, such as calculating the size of a single object using "git cat-file --batch='%(objectsize:disk)' Β» 77 times. Files (".rev") with a reverse index will be stored inside the repository in the ".git/objects/pack" directory.

    Recall that Git stores all data in the form of objects, which are placed in separate files. To increase the efficiency of working with the repository, objects are additionally placed in pack files, in which information is presented in the form of a stream of objects following one after another (a similar format is used when transferring objects with the git fetch and git push commands). An index file (.idx) is created for each pack file, which allows you to very quickly determine the offset in the pack file by which the given object is stored by the object identifier.

    The reverse index included in the new release is aimed at streamlining the process of determining the object ID from information about the location of the object in the pack file. Previously, such conversion was performed on the fly during the parsing of the pack file and was stored only in memory, which did not allow reuse of such indexes and forced the index to be generated each time. The operation of building an index is reduced to building an array of object-position pairs and sorting it by position, which can take a long time for large pack files.

    For example, the operation of displaying the contents of objects, which uses a direct index, was 62 times faster than the operation of showing the size of objects, for which the position-to-object relationship data was not indexed. After using the reverse index, these operations began to take approximately the same time. Reverse indexes also allow you to speed up the operation of sending objects when executing fetch and push commands by directly transferring ready-made data from disk.

    Git 2.41 source control system available

  • Added support for passing WWW-Authenticate headers between the credential handler and the authentication service to the "credential helper" protocol used to pass credentials when accessing restricted repositories. Support for the WWW-Authenticate header allows you to pass OAuth scope parameters to more granularly separate user access to repositories and delimit the scopes available for requests.
  • Added format option "%(ahead-behind: )", which allows you to immediately get information about the number of commits present or absent in a certain branch, relative to another branch (how much one branch lags behind or ahead of another at the level of commits). Previously, getting this information required two separate commands: "git rev-list --count main..my-feature" to get the number of commits unique to a branch, and "git rev-list --count my-feature..main" to get the number missing commits. Now such calculations can be reduced to a single instruction, which simplifies writing handlers and reduces execution time. For example, to show unmerged branches and evaluate whether they are behind or ahead of their main branch, you can use a one-liner: $ git for-each-ref --no-merged=origin/HEAD \ --format='%(refname:short) %(ahead-behind :origin/HEAD)' \ refs/heads/tb/ | column -t tb/cruft-extra-tips 2 96 tb/for-each-refβ€”exclude 16 96 tb/roaring-bitmaps 47 3 instead of the previously used script, which is 17 times slower: $ git for-each-ref - format='%(refname:short)' --no-merged=origin/HEAD \ refs/heads/tb | while read ref do ahead="$(git rev-list --count origin/HEAD..$ref)" behind="$(git rev-list --count $ref..origin/HEAD)" printf "%s %d %d\n" "$ref" "$ahead" "$behind" done | column -t tb/cruft-extra-tips 2 96 tb/for-each-refβ€”exclude 16 96 tb/roaring-bitmaps 47 3
  • Added "--porcelain" option to "git fetch" command, which generates output in the format " ”, less readable, but more convenient for parsing in scripts.
  • Added "fetch.hideRefs" setting to speed up "git fetch" operations by hiding part of the links in the local repository at the stage of verifying that the server sent the full set of objects, which saves time by limiting the check only to servers from which data is directly retrieved. For example, when testing on a system with repositories that contain a large number of tracked external links, excluding all links except those addressed to the $remote target server reduced the "git fetch" operation from 20 minutes to 30 seconds. $ git -c fetch.hideRefs=refs -c fetch.hideRefs=!refs/remotes/$remote \ fetch $remote
  • The "git fsck" command implements the ability to check for corruption, checksum matching, and correctness of values ​​in accessibility bitmaps and reverse indexes.
  • The "git clone --local" command now displays an error when trying to copy from a repository containing symbolic links inside $GIT_DIR.

Source: opennet.ru

Add a comment