Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[commitgraph] Implement commit-graph-verify plumbing command. #26

Merged
merged 9 commits into from
Oct 13, 2020

Commits on Oct 11, 2020

  1. [commitgraph] Stub out commit-graph-verify plumbing command.

    Commit graphs are optional, so commit-graph plumbing is guarded by a
    `commitgraph` feature that is enabled by default.
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    aacf0f0 View commit details
    Browse the repository at this point in the history
  2. [commitgraph] Use thiserror instead of quick_error.

    It doesn't look like `quick_error` supports type parameters on error
    enums, and I want to use type parameters for verification errors.
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    c8b1f74 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1b738ac View commit details
    Browse the repository at this point in the history
  4. [commitgraph] Add Graph::at constructor.

    This constructor tries to accept as many commit-graph-looking paths as
    possible, such as `.git/objects/info`,
    `.git/objects/info/commit-graph`, or `.git/objects/info/commit-graphs`.
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    a783052 View commit details
    Browse the repository at this point in the history
  5. [commitgraph] Tweak File::iter_base_graph_ids implementation.

    * It doesn't use evil `as`.
    * It's a bit less code.
    * It should be a tiny bit faster.
    * It is slightly more strict in that it will panic if the base graphs
      list is not evenly divisible into hashes. The file parser's error
      checking should ensure that this panic never happens, but maybe maybe
      maybe...
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    5b06780 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    28f94b4 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    701f33c View commit details
    Browse the repository at this point in the history
  8. [commitgraph] Implement basic commit-graph file verification.

    Missing features:
    1. It operates on commit-graph files only, so it doesn't verify that
       commit-graph data matches `git-odb` data.
    2. No progress reporting or parallelization. This shouldn't be needed
       until until we need to check against `git-odb` data.
    
    Example output for Linux repo:
    ```
    $ time ./target/release/gixp commit-graph-verify -s ~/src/linux/.git/objects/info
    number of commits with the given number of parents
    	 0: 4
    	 1: 878988
    	 2: 67800
    	 3: 652
    	 4: 408
    	 5: 382
    	 6: 454
    	 7: 95
    	 8: 65
    	 9: 47
    	10: 25
    	11: 26
    	12: 14
    	13: 4
    	14: 3
    	18: 1
    	19: 1
    	20: 1
    	21: 1
    	24: 1
    	27: 1
    	30: 1
    	32: 1
    	66: 1
    	->: 948976
    
    longest path length between two commits: 160521
    
    real	0m0.196s
    user	0m0.180s
    sys	0m0.016s
    ```
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    2571113 View commit details
    Browse the repository at this point in the history
  9. [commitgraph] Clean up {file,graph}::verify::Error types.

    Get rid of `file::verify::EitherError` in favor of having
    `graph::verify::Error` manually copy file errors into the graph error
    object.
    
    So:
    1. `graph::verify::Error`'s `File` variant uses a dummy type parameter
       for its nested `file::verify::Error` value. This dummy type parameter
       is essentially a never type, as
       `graph::verify::Error::File(file::verify::Error::Processor(...))` is
       not valid.
    2. `Graph::verify_integrity` calls `File::traverse` with its normal
       error type (`graph::verify::Error`) also serving as the processor's
       error type.
    3. `Graph::traverse` propagates processor errors to its caller via
       `Error::Processor(err)`.
    4. `Graph::verify_integrity` manually transcribes
       `file::verify::Error<T>` variants into
       `file::verify::Error<NeverType>` variants before embedding the file
        error into `graph::verify::Error::File` variants.
    avoidscorn committed Oct 11, 2020
    Configuration menu
    Copy the full SHA
    fa22cab View commit details
    Browse the repository at this point in the history