[go: up one dir, main page]

Skip to content

refs/ref-cache: stop seeking into empty directories

The 'cache_ref_iterator_seek()' function is used to seek the ref_iterator to the desired reference in the ref-cache mechanism. We use the seeking functionality to implement the '--start-after' flag in 'git-for-each-ref(1)'.

When using the files-backend with packed-refs, it is possible that some of the refs directories are empty. For e.g. just after repacking, the 'refs/heads' directory would be empty. The ref-cache seek mechanism doesn't take this into consideration, causing SEGFAULT as we try to access entries within the directory. Fix this by breaking out of the loop when we enter an empty directory.

Add tests which simulate this behavior and also provide coverage over using the feature over packed-refs.

Closes #583 (closed)

Edited by Karthik Nayak

Merge request reports

Loading