Packed refs file




















Near constant time verification if an object name is referred to by at least one reference for allow-tip-sha1-in-want. A reftable file is a portable binary file format customized for reference storage. References are sorted, enabling linear scans, binary search lookup, and range scans. Storage in the file is organized into variable sized blocks. Prefix compression is used within a single block to reduce disk space.

Block size and alignment is tunable by the writer. Scan read k refs , by reference name lookup single ref from k refs , and by SHA-1 lookup refs with that SHA-1, from k refs :. References stored in a reftable are peeled, a record for an annotated or signed tag records both the tag object, and the object it refers to.

This is analogous to storage in the packed-refs format. Reference names are an uninterpreted sequence of bytes that must pass git-check-ref-format[1] as a valid reference name.

The block size must be larger than the longest reference name or log entry used in the repository, as references cannot span blocks. Powers of two that are friendly to the virtual memory system or filesystem such as 4k or 8k are recommended. Larger sizes 64k can yield better compression, with a possible increased cost incurred by readers during access. Writers may choose to align blocks at multiples of the block size by including padding filled with NUL bytes at the end of a block to round out to the chosen alignment.

Block alignment is not required by the file format. Unaligned files with more than one ref block must include the ref index to support fast lookup. Readers must be able to read both aligned and non-aligned files. Very small files e. For maximum backward compatibility, it is recommended to use version 1 when writing SHA1 reftables.

The first ref block shares the same block as the file header, and is 24 bytes smaller than all other blocks in the file. The first block immediately begins after the file header, at position If the first block is a log block a log-only file , its block header begins immediately at position Readers can start linear scans from any of these records.

The format is described below. Records are formatted as:. The value follows. Symbolic references use 0x3 , followed by the complete name of the reference target.

No compression is applied to the target name. The ref index stores the name of the last reference from every ref block in the file, enabling reduced disk seeks for lookups. Any reference can be found by searching the index, identifying the containing block, and searching within that block. The index may be organized into a multi-level index, where the 1st level index block points to additional ref index blocks 2nd level , which may in turn point to either additional index blocks e.

Disk reads required to access a ref go up with higher index levels. If there are at least 4 ref blocks, a ref index block should be written to improve lookup times. Omitting the index block from smaller files saves space. To reduce the number of reads required for random access in very large files the index block may be larger than other blocks. If not present, the position will be 0. Object blocks are optional. Writers may choose to omit object blocks, especially if readers will not use the object name to ref mapping.

Object blocks use unique, abbreviated object name keys, mapping to ref blocks containing references pointing to that object directly, or as the peeled value of an annotated tag. To save space in small files, object blocks may be omitted if the ref index is not present, as brute force search will only need to read a few ref blocks. When missing, readers should brute force a linear search of all references to lookup by object name. Fields are identical to ref block.

Binary search using the restart table works the same as in reference blocks. Because object names are abbreviated by writers to the shortest unique abbreviation within the reftable, obj key lengths have a variable length. Their length must be at least 2 bytes. Readers must compare only for common prefix match within an obj block or obj index. Like in reference blocks, abbreviations are prefix compressed within an obj block. A reader that needs exact reference names must scan all references to find which specific references have the desired object.

Faster searching by object name within a single ref block is not supported by the reftable format. Smaller block sizes reduce the number of candidates this step must consider. The obj index stores the abbreviation from the last entry for every obj block in the file, enabling reduced disk seeks for all lookups. It is formatted exactly the same as the ref index, but refers to obj blocks. The obj index should be present if obj blocks are present, as obj blocks should only be written in larger files.

The 4-byte block header is followed by the deflated block contents using zlib deflate. Offsets within the log block e. Readers may prefer prefixing the inflation output buffer with the 4-byte header. The log record format is described below. Because log blocks have no alignment or padding between blocks, readers must keep track of the bytes consumed by the inflater to know where the next log block begins.

See the update transactions section below for further details. Log records have a similar starting structure to ref and index records, utilizing the same prefix compression scheme applied to the log record key described above. Readers reading a stack of reflogs must treat this as a deletion. VS Code spawns git for everything git-related. It doesn't look into any folders manually.

Consequently, every time VS Code attempts to sync about every minute it seems an exception is thrown into the Git log stating that it can't find the reference and that it may be packed. Got it. That error is only for file watching. It should not impact the features at all.

Is there a feature which does not work? File watcher exceptions are OK. Nothing breaks. They are useful in the logs in case you have other issues.

Closing this. This might be related to Skip to content. Star k. New issue. Jump to bottom. Labels needs more info. Copy link. Please also check if it is already covered by an existing one, like: vscode-insider layout is broken. RMacfarlane assigned joaomoreno Aug 26, Their numerical values must not. But if somebody. On failure, write an error message to err and.

We just failed. There is no. Report it as a low-level. Try again. It might have. We ensure this as follows:. This causes the loose. After that, we call. This is OK as. This function is. Usually it will create a file named. The function should. On error, it. In this case,. In this.

In other scenarios it will not be. Retry a few times in case we are racing. This is only 1 because if another. We are willing to attempt this. Maybe it is empty; try. If the reference should be. Record the true errno for error reporting,.

If there would be a conflict, emit an error.



0コメント

  • 1000 / 1000