CtrlK
BlogDocsLog inGet started
Tessl Logo

finkel/jgit

JGit documentation and API reference with code examples

92

1.09x
Quality

Pending

Does it follow best practices?

Impact

92%

1.09x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-4/

Git Object Browser with Caching

Problem/Feature Description

Our code review tool needs to efficiently browse Git objects (blobs, trees, commits, tags) across large repositories. The current implementation reads objects directly from disk each time, causing performance issues when the same objects are accessed repeatedly.

We need a Java library that provides cached access to Git objects with the following requirements:

  • Browse repository objects by SHA-1 or reference name
  • Read blob contents with character encoding detection
  • Navigate tree structures recursively or non-recursively
  • Parse commit metadata (author, committer, message, parent relationships)
  • Cache frequently accessed objects (blobs, trees) to improve performance
  • Support configurable cache eviction policies (LRU, size-based, time-based)
  • Provide metrics on cache hit/miss rates for performance tuning
  • Handle large objects efficiently (streaming for blobs > threshold size)
  • Thread-safe for concurrent access by multiple threads

The library will be integrated into a web-based code review system where multiple users browse the same repository simultaneously. Performance is critical for user experience.

Output Specification

Create a Java class GitObjectBrowser with the following functionality:

  1. Constructor: Takes repository path and cache configuration
  2. getBlob(sha1): Returns blob content with caching
  3. getTree(sha1): Returns tree structure with entries
  4. getCommit(sha1): Returns commit metadata
  5. resolveReference(refName): Resolves reference to object SHA-1
  6. getCacheStats(): Returns cache statistics (hit rate, size, evictions)
  7. clearCache(): Clears cache (for testing or memory management)

Include cache implementation using ConcurrentHashMap or a proper caching library pattern.

Expected output files:

  • GitObjectBrowser.java - Main browser class with caching
  • GitCache.java - Cache implementation with configurable eviction
  • CacheStats.java - Statistics tracking class
  • ObjectMetadata.java - Common metadata for Git objects
  • build.gradle or pom.xml - Build configuration
  • README.md - Documentation on configuration and performance tuning

The solution should demonstrate efficient low-level JGit API usage and intelligent caching strategies for Git objects.

tile.json