Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Location of working source?(EGit doesn't seem to allow me to work the way I want to)
icon9.gif  Location of working source? [message #778514] Fri, 13 January 2012 00:15 Go to next message
Don Wills is currently offline Don Wills
Messages: 6
Registered: July 2009
Junior Member
I am having problems making EGit work the way I want it to. I'm either missing something or maybe EGit isn't useful for our organization. Please help me understand.

We've worked the traditional way with CVS for years. Java and C development (mostly in Eclipse, but some command line/vi/make), now doing Objective-C development (XCode=yuck) for a variety of inter-related and some unrelated projects. We decided to move everything to Git.

The plan was for Git to manage all source code control, regardless of where the working copies of the source are, and regardless of the tools used in development, with one central remote server. The idea of local repos that are unrelated to tools seemed great! Thus, for Eclipse we thought we would keep the same workflow which is the working source is in the Eclipse workspace (in the project directory), and the local repo is outside the workspace. Each developer has his own repo. Commit goes to local repo which can then be pushed to remote central repo at certain intervals.

It appears the EGit does not allow us to keep the working source separate from the local repo directory structure. When Team -> Share happens, the project is moved out of the workspace into the Git repo directory structure. That's unacceptable if that's the only way it works. Am I missing something?

In addition, there may be multiple working copies of the source on a local machine, some in Eclipse, some not. We don't want to have any of the .project, .classpath, etc. files in the Git repo. Just source. Is that possible?

TIA for any advice or information.
Re: Location of working source? [message #778558 is a reply to message #778514] Fri, 13 January 2012 09:38 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin Rosenberg
Messages: 331
Registered: July 2009
Senior Member
Don Wills skrev 2012-01-13 01.15:
> I am having problems making EGit work the way I want it to. I'm either missing something or maybe EGit isn't useful for our organization. Please help me understand.
>
> We've worked the traditional way with CVS for years. Java and C development (mostly in Eclipse, but some command line/vi/make), now doing Objective-C development
> (XCode=yuck) for a variety of inter-related and some unrelated projects. We decided to move everything to Git.
>
> The plan was for Git to manage all source code control, regardless of where the working copies of the source are, and regardless of the tools used in development, with one
> central remote server. The idea of local repos that are unrelated to tools seemed great! Thus, for Eclipse we thought we would keep the same workflow which is the working
> source is in the Eclipse workspace (in the project directory), and the local repo is outside the workspace. Each developer has his own repo. Commit goes to local repo which
> can then be pushed to remote central repo at certain intervals.
>
> It appears the EGit does not allow us to keep the working source separate from the local repo directory structure. When Team -> Share happens, the project is moved out of
> the workspace into the Git repo directory structure. That's unacceptable if that's the only way it works. Am I missing something?

Note the checkbox in the wizard. With that you can have the clone in your worspace. I do all the time,
and think it should be the default. Others disagree.

> In addition, there may be multiple working copies of the source on a local machine, some in Eclipse, some not. We don't want to have any of the .project, .classpath, etc.
> files in the Git repo. Just source. Is that possible?

As many as you like. You don't need to have the eclipse files in the git repo. Many maven based
projects don't since maven can create files for you.

> TIA for any advice or information.
Re: Location of working source? [message #778641 is a reply to message #778558] Fri, 13 January 2012 15:54 Go to previous messageGo to next message
Don Wills is currently offline Don Wills
Messages: 6
Registered: July 2009
Junior Member
Thanks for your response, Robin.

Robin Rosenberg wrote on Fri, 13 January 2012 04:38
Don Wills skrev 2012-01-13 01.15:
> ...It appears the EGit does not allow us to keep the working source separate from the local repo directory structure. When Team -> Share happens, the project is moved out of
> the workspace into the Git repo directory structure. That's unacceptable if that's the only way it works. Am I missing something?

Note the checkbox in the wizard. With that you can have the clone in your worspace. I do all the time,
and think it should be the default. Others disagree.


I assume you mean the "Use or create Repository in parent folder of project" checkbox. When I click that, the next dialog only allows for creation of the Repository in the workspace. Attempts to change the location of the repository to anything else result in the Create Repository going grey and the Next navigation button is grey. I want the repository OUTSIDE of the workspace. Did I misunderstand your suggestion, or am I doing something wrong?

Robin Rosenberg wrote on Fri, 13 January 2012 04:38
Don Wills skrev 2012-01-13 01.15:

> In addition, there may be multiple working copies of the source on a local machine, some in Eclipse, some not. We don't want to have any of the .project, .classpath, etc.
> files in the Git repo. Just source. Is that possible?

As many as you like. You don't need to have the eclipse files in the git repo. Many maven based
projects don't since maven can create files for you.



I understand .gitignore. That's part way but still leaves one problem. I only want the file and folders UNDER the src directory. I don't want a /src/com/comp/xxx/... structure in the repo, I want /com/comp/xxx... in the repo. Can this be accomplished?

Again, thanks for the advice Robin. But I'm still stuck.
Re: Location of working source? [message #778855 is a reply to message #778641] Sat, 14 January 2012 00:21 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin Rosenberg
Messages: 331
Registered: July 2009
Senior Member
Don Wills skrev 2012-01-13 16.54:

> I understand .gitignore. That's part way but still leaves one problem. I only want the file and folders UNDER the src directory. I don't want a /src/com/comp/xxx/...
> structure in the repo, I want /com/comp/xxx... in the repo. Can this be accomplished?

Not today. You can add that as a feature request at bugs.eclipse.org. The wizard
could do the mappng of this once upon a time, but I don't think the rest of the plugin
could handle it very well, which might be the reason it was dropped.

You can add it as a feature request and perhaps bribe someone into fixing it. It's
a non-trivial task, I'm afraid. It would be useful for some type of projects. Not
so much for java as for some web projects that use submodules within the projects.

-- robin
Re: Location of working source? [message #779395 is a reply to message #778514] Sun, 15 January 2012 16:13 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
Quote:
The plan was for Git to manage all source code control, regardless of where the working copies of the source are, and regardless of the tools used in development, with one central remote server. The idea of local repos that are unrelated to tools seemed great!


All this is supported by egit, I use it this way for many projects.


Quote:
Thus, for Eclipse we thought we would keep the same workflow which is the working source is in the Eclipse workspace (in the project directory), and the local repo is outside the workspace. Each developer has his own repo.


I understand that it is possible, though very unusual, in command-line Git to split the working directory from its repository. Jgit apparently doesn't support this yet, but even if it did, I'm curious why you would want to do it. What is this buying you? For sure this is not standard Git usage.

Assuming you decide to use git in the standard way, with the working directory connected to its repository, you can put it anywhere you want. Some developers like to keep git repos in the workspace directory. That seems weird to me, so I put them elsewhere, just as I used to do with CVS and SVN checkouts. Egit/Jgit happily works with either pattern.

Quote:
In addition, there may be multiple working copies of the source on a local machine, some in Eclipse, some not. We don't want to have any of the .project, .classpath, etc. files in the Git repo. Just source. Is that possible?


You can of course have any number of repository clones of the same origin and you can use any of them with any git tools you like, including egit/jgit. No issues there, I do this all the time.

But I don't see the logical connection between multiple copies, on the one hand, and tracking Eclipse .project and .classpath files, on the other. What does one have to do with the other?

The bigger question is, why would you not want to include .project and .classpath (and .settings) in the repository? Aren't they the same for everyone? If so, why not share them? By not sharing you force each user to recreate these manually. If they're not the same but the source-code is the same, there's a fair chance your Java project isn't set up correctly.
icon5.gif  Re: Location of working source? [message #779424 is a reply to message #779395] Sun, 15 January 2012 17:51 Go to previous messageGo to next message
Don Wills is currently offline Don Wills
Messages: 6
Registered: July 2009
Junior Member
As I said in my original post, we're doing development with and without Eclipse, for multiple languages, and for multiple projects, both inter-related and independent.

I won't reply to questions of the form "I don't understand why you want to do X, I suggest you do it another way".

In response to my questions about setting up the local Git repo the way I want to with the repo unrelated to and separate from Eclipse by keeping the working source inside the Eclipse workspace directory structure, R Shapiro wrote "All this is supported by egit, I use it this way for many projects.", but Robin Rosenburg wrote "Not today. You can add that as a feature request at bugs.eclipse.org." Which is it?

Am I still missing something? Do I need to use the EGit Wizard to connect my projects to Git? My common non-Eclipse-expert definition of the word Wizard implies that a Wizard simplifies set up of a bunch of configuration options, but that one does not need to use a Wizard - the same end result can be accomplished in a different way. Is the use of the EGit Wizard necessary?

Re: Location of working source? [message #779429 is a reply to message #779395] Sun, 15 January 2012 18:07 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin Rosenberg
Messages: 331
Registered: July 2009
Senior Member
R Shapiro skrev 2012-01-15 17.13:
> Quote:
>> The plan was for Git to manage all source code control, regardless of where the working copies of the source are, and regardless of the tools used in development, with
>> one central remote server. The idea of local repos that are unrelated to tools seemed great!
>
>
> All this is supported by egit, I use it this way for many projects.
>
>
> Quote:
>> Thus, for Eclipse we thought we would keep the same workflow which is the working source is in the Eclipse workspace (in the project directory), and the local repo is
>> outside the workspace. Each developer has his own repo.
>
>
> I understand that it is possible, though very unusual, in command-line Git to split the working directory from its repository. Jgit apparently doesn't support this yet, but
> even if it did, I'm curious why you would want to do it. What is this buying you? For sure this is not standard Git usage.

It is useful for scripting. JGit does support it, much the same way that C Git does, through e.g. GIT_WORKTREE
and GIT_DIR environment variables or through the API. That does not extend to EGit in any meaningful way.

> Assuming you decide to use git in the standard way, with the working directory connected to its repository, you can put it anywhere you want. Some developers like to keep
> git repos in the workspace directory. That seems weird to me, so I put them elsewhere, just as I used to do with CVS and SVN checkouts. Egit/Jgit happily works with either
> pattern.
>
> Quote:
>> In addition, there may be multiple working copies of the source on a local machine, some in Eclipse, some not. We don't want to have any of the .project, .classpath, etc.
>> files in the Git repo. Just source. Is that possible?
>
>
> You can of course have any number of repository clones of the same origin and you can use any of them with any git tools you like, including egit/jgit. No issues there, I
> do this all the time.
>
> But I don't see the logical connection between multiple copies, on the one hand, and tracking Eclipse .project and .classpath files, on the other. What does one have to do
> with the other?
I think that was another question, in the same message. There is no connection there as I see it.

>
> The bigger question is, why would you not want to include .project and .classpath (and .settings) in the repository? Aren't they the same for everyone? If so, why not share
> them? By not sharing you force each user to recreate these manually. If they're not the same but the source-code is the same, there's a fair chance your Java project isn't
> set up correctly.

You may want to avoid duplication or project information. If, say maven, has that you can use it to
generate the .project and .classpath and some other information.

-- robin
Re: Location of working source? [message #779438 is a reply to message #779424] Sun, 15 January 2012 18:43 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
Quote:
Which is it?


This is only superficially a conflict between what Robin said and what I said. We were responding to different questions in your post.

The quote I was responding to said nothing about separating the working directory from its repository, which is a very unusual way of using git. I didn't know it was possible until I saw it referenced on this forum. If you're absolutely determined to do this, you should probably stay with command-line Git.

Or take a step back and reconsider your need for this fairly exotic feature. I'm sorry if that suggestion offends you, I don't see why it should. It's always worth a second thought if you find yourself in need of a very unusual feature of a tool you're only just starting to learn. In my experience, after a second (or third) look I realize I don't need it after all, I just thought I did because I was trying to force the new tool into an old model. Happens to me all the time when I learn a new development tool or programming language.




Re: Location of working source? [message #923815 is a reply to message #778514] Wed, 26 September 2012 08:11 Go to previous message
Owen Nargodren is currently offline Owen Nargodren
Messages: 1
Registered: September 2012
Junior Member
Hello,

I'm also looking for a way to do this. I'd like to use the "standard" workspace layout whatever version system I use. What I'm used to is:

~/Workspace/ProjectX/.project
~/Workspace/ProjectX/src/
~/Workspace/ProjectY/.project
~/Workspace/ProjectY/src/

and it would be great if the git repositories could be outside the workspace without changing the directory structure:

~/git/ProjectX.git/.git
~/git/ProjectY.git/.git


Especially if you work with content files (images, textures, binary data, meshes, animations etc) and want to manage a content related project, that also needs to access / reuse content from other "content modules", you want a simple file structure, that is not dependent of the file path of the repository.

Maybe it is just a matter of habit? I've just recently started with git, and think it is awesome, if not almost genius compared to svn, but this is a bit of a let down, since it breaks existing functionality.

Kind Regards,
Owen
Previous Topic:Is the stash/apply running well in EGit 2.0
Next Topic:Use EGit For PHP Deployment (like FTP client)
Goto Forum:
  


Current Time: Sun Oct 26 04:39:49 GMT 2014

Powered by FUDForum. Page generated in 0.05856 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software