Closed wszostak closed 8 years ago
Where would the hooks directory then be? In the root?
It can be anywhere.
This is example:
Assume that working copy is in: /home/user/repo/
and in this folder is file .git
with gitdir: ../repositores/repo
content. Then bare repository is in /home/user/repositories/repo
. So hooks should be saved in /home/user/repositories/repo/hooks
Are you talking about a setup where you have the current (any) repository and an additional bare repo at the same machine? Could you please provide some links or context to understand your scenario more easily? It's quite uncommon to treat two different repositories as something that lives in the same place.
Here is example.
├── git-dir-outside
│ ├── branches
│ ├── COMMIT_EDITMSG
│ ├── config
│ ├── description
│ ├── HEAD
│ ├── hooks
│ │ ├── applypatch-msg.sample
│ │ ├── commit-msg.sample
│ │ ├── post-update.sample
│ │ ├── pre-applypatch.sample
│ │ ├── pre-commit.sample
│ │ ├── prepare-commit-msg.sample
│ │ ├── pre-push.sample
│ │ ├── pre-rebase.sample
│ │ └── update.sample
│ ├── index
│ ├── info
│ │ └── exclude
│ ├── logs
│ │ ├── HEAD
│ │ └── refs
│ │ └── heads
│ │ └── master
│ ├── MERGE_RR
│ ├── objects
│ │ ├── 35
│ │ │ └── d12458f7e44e84bfb7e586dd79dd4a4a109e78
│ │ ├── 9d
│ │ │ └── aeafb9864cf43055ae93beb0afd6c7d144bfa4
│ │ ├── c1
│ │ │ └── 2d7c0ed49ad9c7aa938743ba6fdee54b6b7fe1
│ │ ├── info
│ │ └── pack
│ ├── refs
│ │ ├── heads
│ │ │ └── master
│ │ └── tags
│ └── rr-cache
└── work-tree
├── .git
└── README.md
As you can see. .git
is file. It contains only gitdir: ../git-dir-outside
text. The git-dir is outside work tree.
How would we know where the hooks folder is? Is there a reliable way? Some file to look at where we should point it to? Or would we need to recursively search the tree?
if work-tree/.git
is regular file, read it. It contains gitdir:
followed by git repository path (gitdir: ../git-dir-outside
). So in our example ../git-dir-outside/hooks
is hooks dir.
Ok. It would have been a bit simpler if you would have linked the documentation about it :palm_tree:
After reading into this, I found another possibility to set a git dir location outside the default location:
--separate-git-dir=<git dir>
In this StackOverflow answer, I found the way how you maybe set this up:
git --git-dir=/path/to/repo.git --work-tree=. init && echo "gitdir: /path/to/repo.git" > .git
Can you confirm this? To give you an idea why I am asking in that detail: Me or anyone else willing to jump in and help finding out what needs to change and where the changes need to be put, need to reproduce your setup somehow. So in short: If you can help documenting how to
then we are way faster to patch up a solution.
@wszostak As it just came to my mind: have you ever tried the dest
option? Did it simply fly below your radar? :)
Closing as the needed info is missing since more than a year now.
It is possible in Git that
.git
is not a directory but regular file.When I create such a file with content:
, Git knows that its files are in different path.
grunt-githooks, however, does not follow this link and returns error: