On Tue, Jul 12, 2016 at 9:45 PM, Christian Couder <christian.couder@xxxxxxxxx> wrote: > On Tue, Jul 12, 2016 at 5:12 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote: >> >> No. People could create an index file anywhere in theory. So you don't >> know how many index files there are. > > Maybe when an index file is created, its path and its sharedindex file > could be appended into a log file. > We could check this log file to see if we can remove sharedindex files. > We would need to remove the entries in this log file for the indexes > that are no longer there. > > Or instead of one log file we could have a file for each index file in > a special directory called for example "indexinfo". > So we could just delete the file if its related index is no longer there. New files will require locking so people don't append at the same time. And maybe another new host of problems. I think we can just go with the garbage collection way that we have done for unreachable objects. Your indexinfo idea looks very close to multiple locking, an index would lock the shared index it's linked to, preventing it from being removed. For single locking, we can just create a file named $X.lock, but for multiple locks, maybe we can go with $X.lock-$index_trailing_sha1. Will it work? I don't know. Just thinking out loud. >> It really depends. If the shared part is too small for old indexes, we >> might as well unsplit them. In practice though, the only long-term >> index file is $GIT_DIR/index. If we don't delete old shared index >> files too close to their creation time, temp index files will go away. > > We could treat $GIT_DIR/index specially so that if there are no temp > index files, there should be nothing in "indexinfo". No, temp index files are needed. And it will be hard to treat $GIT_DIR/index specially because updating it involves a temp index: you first prepare a new index in $GIT_DIR/index.lock. If everything goes well, you atomically rename it to $GIT_DIR/index. You may be able to treat $GIT_DIR/index.lock special too, but that's starting to get out of hand. -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html