After two months of development, the release of the distributed version control system Git 2.39 has been published. Git is one of the most popular, reliable, and high-performance version control systems, providing flexible tools for nonlinear development based on branching and merging. To ensure the integrity of history and resistance to "backdating" changes, implicit hashing of the entire previous history is employed in each commit, and digital signatures from developers can be used to verify specific tags and commits.
Compared to the previous release, the new version includes 483 changes prepared with the participation of 86 developers, of whom 31 participated for the first time. Key innovations:
- The ‘git shortlog’ command, intended for displaying summaries with statistics from the change history, has added the option ‘—group’ for arbitrary grouping of commits by fields not limited to the author or committer. For example, to show a list of developers with information about the number of changes, including helpers mentioned in the ‘Co-authored-by’ field, the command can be used: git shortlog -ns —group=author —group=trailer:co-authored-by
The output of shortlog can be aggregated using formatting specifiers, and the option "--group" simplifies the creation of complex reports and eliminates the need for additional sorting commands. For example, to create a report showing how many commits for a specified release were made in each month, you can specify: git shortlog v2.38.0.. --date='format:%Y-%m' --group='' -s 2 2022-08 47 2022-09 405 2022-10 194 2022-11 5 2022-12 Previously, performing a similar operation would have required using the sort and uniq utilities: git log v2.38.0.. --date='format:%Y-%m' --format='' | sort | uniq -c
- The capabilities of the 'cruft packs' mechanism, designed for packaging unreachable objects that have no references in the repository (neither branches nor tags point to them), have been extended. Unreachable objects are removed by the garbage collector, but they remain in the repository for a certain period before deletion to prevent race conditions. The 'cruft packs' mechanism allows all unreachable objects to be stored in a single pack file, while the modification time of each object is reflected in a separate table stored in an additional file with the '.mtimes' extension, so they do not overlap with the overall modification time.
The duration that unreachable objects remain in the repository before actual deletion is determined by the '--prune=' option. While the delay before deletion is an effective and practical way to prevent repository corruption due to race conditions, it is not 100% reliable. To simplify the recovery of a damaged repository, a new feature has been introduced to save missing objects. The 'git repack' command now includes the '--expire-to' option, which allows you to specify a file to create an external copy of all deleted objects. For example, to save unreachable objects that have not changed in the last 5 minutes to a file named backup.git, you can use the command: git repack --cruft --cruft-expiration=5.minutes.ago -d --expire-to=../backup.git
- The speed of the 'git grep --cached' operation has significantly increased (by up to 70%) when searching in areas where sparse checkout is applied and where partial indexes (sparse index) exist. Previously, when the '--cached' option was specified, the search was first performed in the regular index and then in the partial indexes, resulting in noticeable delays when searching in large repositories.
- Execution speed has been accelerated for server checking the connectivity of new objects before they are added to the repository during the 'git push' operation. By switching to considering only declared references during validation, optimizations made in a test repository with 7 million references, of which only 3% are covered by the push operation, reduced the validation time by 4.5 times.
- To prevent potential integer overflows in the code, the maximum size of patches processed by the 'git apply' command is limited. If a patch exceeds 1 GB, an error will now be displayed.
- To address potential vulnerabilities, changes have been made to clean up unnecessary information from headers output when using the h2h3 module with the GIT_TRACE_CURL=1 or GIT_CURL_VERBOSE=1 options alongside HTTP/2.
- When performing a checkout operation with a branch that is a symbolic link to another branch, the 'git symbolic-ref HEAD' command now outputs the name of the target branch rather than the name of the symbolic link.
- Support for the @{-1} argument has been added to the '--edit-description' option ('git branch --edit-description @{-1}') for editing the description of the previous branch.
- The 'git merge-tree --stdin' command has been introduced, allowing a list of parameters to be passed through standard input.
- The fsmonitor handler, which tracks changes in the filesystem, is disabled by default on network file systems.
Source: opennet.ru
