Page MenuHomePhabricator

Skip "git for-each-ref" when identifying deleted commits
ClosedPublic

Authored by epriestley on Mar 28 2021, 5:58 PM.
Tags
None
Referenced Files
F15241267: D21658.id51535.diff
Mon, Feb 24, 4:00 PM
F15202242: D21658.diff
Sun, Feb 23, 9:17 PM
Unknown Object (File)
Sat, Feb 22, 6:23 AM
Unknown Object (File)
Sat, Feb 22, 5:24 AM
Unknown Object (File)
Fri, Feb 21, 6:20 PM
Unknown Object (File)
Wed, Feb 19, 6:55 PM
Unknown Object (File)
Tue, Feb 18, 2:37 AM
Unknown Object (File)
Jan 23 2025, 12:30 PM
Subscribers
None

Details

Summary

Ref T13647. The ref discovery process prunes commits that no longer exist in the repository before executing "git log <new heads> --not <old heads>" to identify newly published commits.

If we don't do this, the "git log" command will fail if any old head has been pruned from the repository.

Currently, this test for missing commits starts with a call to "git for-each-ref" to attempt to resolve symbols as tag or branch names, but:

  • this is painfully slow in repositories with many refs; and
  • this is incorrect (not consistent with "git" behavior) for 40-character hex strings, which Git will never resolve as symbolic names.

Instead, when a symbol is a 40-character hex string, skip "git for-each-ref" and jump directly to "git cat-file --batch-check".

Test Plan
  • Ran bin/repository update in a repository with 65K refs and extra debugging info.
    • Before: took ~30s, three calls to git for-each-ref.
    • After: took ~20s, two calls to git for-each-ref. Same resolution result on queries.

Diff Detail

Repository
rP Phabricator
Branch
update1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25340
Build 34988: Run Core Tests
Build 34987: arc lint + arc unit