Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for --git-dir and .git file #31

Closed
dolanor opened this issue Oct 24, 2012 · 4 comments
Closed

Support for --git-dir and .git file #31

dolanor opened this issue Oct 24, 2012 · 4 comments

Comments

@dolanor
Copy link

dolanor commented Oct 24, 2012

There is a great option for git which can put the git dir (.git) into another directory/tree.
Combined with --work-tree option, you can init a git repository to another directory, while the work-tree is considered on the right path.
To achieve this without hassle and without passing --git-dir and --work-tree at each invocation of git command, you create a .git file which contains
gitdir: /path/to/the/real/git/repo

I think I began to use it because there must be some kind of limitation of just using a symbolic link to another directory, but I don't remember why exactly

@charleso
Copy link
Owner

Hi Dolanor,

Not to sound negative, but I'm not sure I understand the motivation for this. What benefit does this have over the normal Git dir + working tree setup?

I suppose I'm slightly worried that you might be trying to mix the Clearcase and Git directories up?

Charles

@dolanor
Copy link
Author

dolanor commented Oct 24, 2012

My need is that I ran git init at the top of the clearcase view. And I wanted that all the objects/pack/ref should be saved in another filesystem.
I don't know if it was good or bad to run the git init here, but that's what I did.
And to achieve the other "git directory" trick, I used the git-dir and work-tree.

Right now, I won't need to develop, it is just to see if the history can be imported successfully. But if it works, I need to stay in that directory tree which is the mount of my view, because legacy code, oldies, hard coded path and all the stuff that make you want to kill yourself ;)

@charleso
Copy link
Owner

Yeah, that's what I suspected. You're going to run into all sorts of problems with this approach, or at least not get the full benefits of git-cc. For example you won't be able to use Git local branching if you stay within in the Clearcase view. Even more annoying, and this is the part that really drove me spare with Clearcase, you'll still have to checkout/checkin files with Clearcase, which is so sloooowwwwww. If you use a separate Git directory you won't have to worry about this any more, and you can push your changes back to Clearcase when you're ready.

I realise that using Git directly may not be an option if you have hard coded paths, although I would highly recommended investigating if that can be hacked/fixed locally. If you don't mind me asking, how much would need to be changed? What kind of paths are we talking, and shouldn't they be relative? Alternatively, could you change the mount directory of Clearcase and move your Git view in place of the Clearcase one?

For now I'm afraid you'll have to keep the git-cc directory separate. There are far too many places where I rely on a mutable filesystem. Hopefully for now it should just be a simple matter of moving the current .git directory somewhere else, and running 'git reset --hard HEAD'? After that you will need to run git-cc commands from there. If you didn't provide an absolute URL for 'git-cc init' you will also need to update the '.git/gitcc' config file - but that doesn't affect what you've already imported. If you really want to run git commands from within Clearcase after the import, you can still use 'git-dir' to point to the git-cc repo from within Clearcase. Although you'll be missing out on all the fun... ;-)

@dolanor
Copy link
Author

dolanor commented Oct 24, 2012

Ok, thanks for the explanation. I will try to update the readme so it is more understandable to use that system in that fashion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants