lib: make DB more portable accorss git versions

Many linux machines have a `git` installation that does not have the
`-C` option yet. This patch replaces it with the older combinartion of
`--work-tree` and `--git-dir`.