Skip to contentSkip to conversation

Referring to other repositories

DISCUSSION Maaartin 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Maaartin

author
#0 lore raw

I'm using multiple repositories corresponding to different projects. Currently, all the projects reside in different subdirectories of the same directory, like work/A
work/B
work/C
There are some dependencies like B and C depending on A. Until now, my git knows nothing about it and it works fine, since most changes of A are unimportant for B and C (as A is my general purpose code which doesn't change much). There are three kinds of changes in A:
- unrelated changes completely irrelevant to the other projects (vast majority)
- changes made because of either B or C (sometimes)
- unrelated changes forcing updating B and/or C (very seldom)
Not keeping track about A in the other projects would be a problem if I was to use git bisect. Having to checkout the corresponding version of A when checking out an old version of B or C manually, is just an inconvenience, no real problem.

I know about git submodule, however IIUIC it needs the other project to become a subdirectory of the master, but I can hardly make A to subdirectory of both B and C (I'm a poor Windows user, so no symlinks). I could make copies of A as subdirectories, but having A thrice would be very impractical:
- I'd have to avoid modifying the copies instead of the master.
- All three versions would show up in my IDE.
- I'd have to keep them in sync.
So it looks like using submodules is no option, but I hope you tell me that I'm wrong.

What other possibilities are there? For the normal use, I'd be happy with git tracking the commit id of A somehow. I think I could do it by saving the output of
GIT_DIR=/e/work/A git log --max-count=1 --format=format:%H
in a file using a pre-commit hook. Or is there a better way?

For git bisect (which I haven't used yet but I'm going to), I'd need a way to check out the right version of A automatically, this could be done as part of the command given to git bisect run, right?

#1 lore raw
Quoted 6 lines · Maaartin

I'm using multiple repositories corresponding to different projects. Currently, all the projects reside in different subdirectories of the same directory, like work/A
work/B
work/C
There are some dependencies like B and C depending on A.

[...]

Quoted 3 lines

I know about git submodule, however IIUIC it needs the other project to become a subdirectory of the master, but I can hardly make A to subdirectory of both B and C (I'm a poor Windows user, so no symlinks).

[...]

Quoted 2 lines

So it looks like using submodules is no option, but I hope you tell me that I'm wrong.

Windows supports directory-only symlinks on NTFS >= 3.0 (starting with Windows 2000, that is), see [1], and it seems that since Vista there are true symlinks (did not have a chance to use them yet).
I'm not sure if msysgit will play nicely with them, but at least you could try.

[...]

1. http://en.wikipedia.org/wiki/NTFS_junction_point