Set --work-tree as well as --git-dir when calling git

It's not needed now, but whould we ever add destructive commands,
--work-tree would default to getcwd(), making something like 'git clean'
clean up something unexpected. For bare repos --work-tree is set to
/nonexistent.
Fix bugs in the history view