saltstack/salt — pull request #4376 by mou (2013-04-04 16:13:23+00:00)
Title: Fix file_find and file_hash in gitfs.

I noticed what i have persistent empty diff but changed state from `file.managed`, when use gitfs.
After couple of hours of debugging i found main cause of problem

```python
path = fnd['path']
hashdest = os.path.join(
__opts__['cachedir'],
'gitfs/hash',
short,
'{0}.hash'.format(path))
```
`fnd['path']` suplied by find_file contains absolute path, not relative, so `os.path.join` symply returns last argument (file located in ./refs, not ./hash), so file with hash placed in wrong place. Also, created file dosn't contain hash type information in his name. When i fixed this issue, i noticed what logic in `find_file` is not conforms with logic fixed `file_hash` function. Now it supports holding cache of hashes of multiple digests. To distinct hash files from lock, i prepend extension with `.hash`. To distinct result of sha1 hashing from git blob's sha1 (it's always differs) i changed extension of file in which blob's sha1 is stored.