On Monday, November 25, 2013 2:50:31 AM UTC+1, Mickey Killianey wrote:
>
> Does anyone know where I can store extra resources of my own in the .git 
> directory?  I'm writing a git extension with some fairly expensive analytic 
> computations that I'd like to cache, so that partial results can be reused 
> across multiple invocations.
>
> I was hoping to find some kind of "userspace" in 
> https://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html<https://www.google.com/url?q=https%3A%2F%2Fwww.kernel.org%2Fpub%2Fsoftware%2Fscm%2Fgit%2Fdocs%2Fgitrepository-layout.html&sa=D&sntz=1&usg=AFQjCNE8mKFfAckcN6IKy-z9nplbxARwhg>where
>  my git extensions can save items that shouldn't be associated with a 
> commit/branch/tag.
>
> For example, if I have a results file, would it be reasonable for me to 
> add it the object store using git-hash-object, and then put the SHA1 of 
> that blob in .git/refs/blobs/my-cached-results?  Or, if I have several 
> different files I want to save, could I bundle them under a tree object 
> (presumably using git-write-tree), and save that SHA1 to 
> .git/refs/trees/my-cached-files?  Assuming that the files were the standard 
> format of 40 hex characters plus newline, would this be sufficient to 
> protect the trees/blobs from garbage collection?
>

Have a look at 
git-notes: https://www.kernel.org/pub/software/scm/git/docs/git-notes.html
 

>
> Or am I better off *not* using the object store?  If I should just write 
> results into a file somewhere under the .git directory, is there a 
> recommended place to put such things so that I'm relatively unlikely to 
> collide with future git features?
>
>
This depends on what your needs are. Obviously, if things are not in the 
object store, they can't be conveniently pushed or pulled to other 
repositories. As far as I know, there's no convention on this (the only 
example I can think of is git-svn which creates and stores stuff inside 
.git/svn), but if your files are not really related to Git core itself, I 
would rather put them in some directory outside the .git/ folder and then 
ignore it with .gitignore. 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to