[pass] Multiple git repos in single tree

Brian Candler b.candler at pobox.com
Tue May 10 15:05:08 CEST 2016


On 09/05/2016 17:40, Emil Lundberg wrote:
> This should be easily doable, assuming git>=1.8.2 (if memory serves). 
> Something like this (completely untested):
>
>     git -C "$(dirname \"$passfile\")" add "$passfile"
>
> Since git already does the walking up to the nearest working directory 
> ancestor.

Looks like it needs a $(basename) as well, since passfile is relative to 
the -C directory. But otherwise, looks like it could do the trick:

$ git --version
git version 2.6.1

$ pwd
/Users/brian/tmp

$ mkdir foo bar

$ (cd foo; git init)
Initialized empty Git repository in /Users/brian/tmp/foo/.git/

$ (cd bar; git init)
Initialized empty Git repository in /Users/brian/tmp/bar/.git/

$ touch foo/baz

$ git -C foo add foo/baz
fatal: pathspec 'foo/baz' did not match any files

$ git -C foo add baz
$ mkdir foo/qux
$ touch foo/qux/xyzzy
$ git -C foo/qux add xyzzy
$ git -C foo/qux commit -m 'Yay'
[master (root-commit) 1b19fc0] Yay
  2 files changed, 0 insertions(+), 0 deletions(-)
  create mode 100644 baz
  create mode 100644 qux/xyzzy

Regards,

Brian.


More information about the Password-Store mailing list