Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » How to separate Eclipse and Git metadata
How to separate Eclipse and Git metadata [message #1006557] Thu, 31 January 2013 17:31 Go to next message
Malte Forkel is currently offline Malte ForkelFriend
Messages: 10
Registered: January 2013
Junior Member
Hello,

I would like to use Eclipse and EGit to work on projects that use Git repositories but don't necessarily use the Eclipse platform. So I would like to keep Eclipse metadata out of the repository. Unfortenately, I can't manage to setup my directory structure accordingly.

After reading the Considerations for Git Repositories to be used in Eclipse, I cloned the remote Git repositories to directories outside of the Eclipse workspace. Now, whether I use Import... > Git > Projects from Git or first add the repositories in the Git Repository Exploring perspective and import then, I always seem to end up with a layout like
 - Eclipse workspace
   .metadata
   - project directory (and Git working directory)
     .project
     .git
     ...

The Eclipse project metadata is inside the Git working directory. Which is what I'd like to avoid.

I thougt a layout like this would be more suitable:
 - Eclipse workspace
   .metadata
   - project directory
     .project
     - working directory
       .git
       ...

Adding the working directory to the project as a linked folder will result in this directory layout. But the working directory is not displayed as a Git repository in the Project Explorer and, more importantly, there are not Git commands below Team in the context menu.

May be my idea of how to setup things is flawed? How are you doing this?

Thanks,
Malte


Eclipse Platform, Version: 4.2.1.v20120814,
Eclipse EGit, Version 2.1.0.201209190230-r
Re: How to separate Eclipse and Git metadata [message #1006570 is a reply to message #1006557] Thu, 31 January 2013 19:57 Go to previous messageGo to next message
Philippe is currently offline PhilippeFriend
Messages: 100
Registered: July 2009
Senior Member
Hello Malte,

Did you set the 'default repository folder' (Preferences/Team/Git) ?

Regards,
--
Philippe
Re: How to separate Eclipse and Git metadata [message #1006577 is a reply to message #1006570] Thu, 31 January 2013 20:45 Go to previous messageGo to next message
Malte Forkel is currently offline Malte ForkelFriend
Messages: 10
Registered: January 2013
Junior Member
Hello Philippe,

the value of 'default repository folder' is a non-existing directory named git in my Windows home directory. I don't think I set that value myself, though.

How does that setting influence the directory layout?

Malte
Re: How to separate Eclipse and Git metadata [message #1006634 is a reply to message #1006557] Fri, 01 February 2013 09:39 Go to previous messageGo to next message
Fabien F. is currently offline Fabien F.Friend
Messages: 7
Registered: September 2011
Junior Member
Hello Malte,

You should use a .gitignore file.
Create a file named .gitignore in your working directory and add .project into this file.
.project files will not be commited.

Regards.
Re: How to separate Eclipse and Git metadata [message #1006644 is a reply to message #1006634] Fri, 01 February 2013 10:08 Go to previous messageGo to next message
Malte Forkel is currently offline Malte ForkelFriend
Messages: 10
Registered: January 2013
Junior Member
Hello Fabien,

thanks for your suggestion.

I had thougt about that, but I don't think its a safe solution.

If I used .gitignore, I'd have to make sure that all Eclipse metadata files were listed and not used by the project itself. Plus, I'd have to differentiate between my changes to .gitignore that are project-related (and which I'd want to push) and changes to .gitignore that are Eclipse-specific (which I wouldn't want to push).

Generally, I think Eclipse should not force me to clutter my project with its metadata. There is no guarantee that Eclipse metadata files won't interfere with regular project files, especially if many people work on the same project using different tools. E.g., even .project might be a valid file in the original project.

So, while .gitignore might work most of the time, I still hope there is another way to organize the project in Eclipse.

Regards,
Malte
Re: How to separate Eclipse and Git metadata [message #1006709 is a reply to message #1006644] Fri, 01 February 2013 14:07 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
If you want to work with this repository in Eclipse, include the relevant project metadata as version-controlled files. Any other team member who wants to use Eclipse can then do so without having to add their own setup manually, and all Eclipse users will get a consistent structure and settings. If some team members aren't yet using Eclipse, they get a few small files they won't ordinarily see anyway. So what?

If you set it up this way the import will work fine, assuming you have a relatively recent EGit, and things will be simpler in the long run. You might even convince other team members that Eclipse is the way to go.


The workspace .metadata is something else entirely. That of course does not belong in the repository, and, as you point out, .metadata is not a good home for the clone.

Re: How to separate Eclipse and Git metadata [message #1006752 is a reply to message #1006709] Fri, 01 February 2013 16:44 Go to previous messageGo to next message
Malte Forkel is currently offline Malte ForkelFriend
Messages: 10
Registered: January 2013
Junior Member
I want to work with these repositories in Eclipse, but I don't want to have to include the project metadata as version-controlled (or uncontrolled) files Smile .

I happily agree that it can be very helpful to include project metadata in the repository, especially if the project team has selected a common tool like Eclipse.

But what about other types of project, e.g. open source projects? Git might be the common denominator for source code management. But there is no well-defined team and no common tool selection. I wouldn't want other people to clutter the project data with their tool's metadata. Therefore I wouldn't want to do it myself. Plus, and that's probably the stronger argument, nobody can guarantee that some tool's metadata doesn't interfere with the project data. Unfortenately, the metadata file names used by Eclipse are pretty generic (e.g. .project).

So while it might be just fine to use a layout where working directory and project directory coincide, I'd still appreciate the opportunity to setup things differently.
Re: How to separate Eclipse and Git metadata [message #1006775 is a reply to message #1006577] Fri, 01 February 2013 18:48 Go to previous messageGo to next message
Philippe is currently offline PhilippeFriend
Messages: 100
Registered: July 2009
Senior Member
Yes, this is the folder where EGit proposes to import your repository...

The destinition field of the import wizard should be prefilled with the
value defined in your preferences.
In all case, you can change this setting, and import your repository in the
location of your choice...

Regards,
--
Philippe
Re: How to separate Eclipse and Git metadata [message #1006835 is a reply to message #1006775] Sat, 02 February 2013 17:07 Go to previous messageGo to next message
Malte Forkel is currently offline Malte ForkelFriend
Messages: 10
Registered: January 2013
Junior Member
Philippe, I'm not quite sure which of the import commands you are referring to. I have tried File > Import... and Import... in the Project Explorer's context menu of the C++ Project View as well as Import Projects... in the Git Repositories View. In the end, they all guide me into creating a new project with the working directory coinciding with the workspace directory.

The only way I found to come close to the setup that I like is to import a remote repository to a destination outside of the workspace and cancel the wizard before a new project gets created. I can then add that repository as a linked folder to a project. But I have to manage the repository in the Git Repository View because there are no repository-related commands available in the Project Explorer's context menu.

I guess, my preferred directory layout simply is not supported by EGit Sad.

[Updated on: Sat, 02 February 2013 17:07]

Report message to a moderator

Re: How to separate Eclipse and Git metadata [message #1007007 is a reply to message #1006835] Sun, 03 February 2013 19:33 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
[Quote:
There is no guarantee that Eclipse metadata files won't interfere with regular project files


This is the core of your problem. If it's a realistic concern, rather than a purely theoretical one, you might as well give up on Eclipse right now: there's no way you'll ever get it to work if some 'regular' file conflicts with an Eclipse metadata file.

If it isn't a real concern, and chances are excellent that it isn't, then you have two good options, both of which will solve your problem: commit the metadata files, or add them as gitignored. Both are very simple to do. Committing them has the advantage of helping your team-mates use Eclipse too. Surely at least one of them would appreciate this?

[Updated on: Sun, 03 February 2013 19:46]

Report message to a moderator

Re: How to separate Eclipse and Git metadata [message #1007015 is a reply to message #1006835] Mon, 04 February 2013 00:07 Go to previous message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
Malte Forkel skrev 2013-02-02 18.07:> Philippe, I'm not quite sure which of the import commands you are referring to. I have tried File > Import... and Import... in the
Project Explorer's context menu of the
> C++ Project View as well as Import Projects... in the Git Repositories View. In the end, they all guide me into creating a new project with the working directory coinciding
> with the workspace directory.
>
> The only way I found to come close to the setup that I like is to import a remote repository to a destination outside of the workspace and cancel the wizard before a new
> project gets created. I can then add that repository as a linked folder to a project. But I have to manage the repository in the Git Repository View because there are no
> repository-related commands available in the Project Explorer's context menu.
> I guess, my preferred directory layout simply is not supported by EGit.

In the third page of Import..Project from Git you can enter a directory where you want to clone to land, including inside your workspace the way you describe.

-- robin
Previous Topic:"Building Workspace" slow with EGit 1.1 and Nightly
Next Topic:accessing Github from behind an http proxy
Goto Forum:
  


Current Time: Sun Dec 21 04:51:56 GMT 2014

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

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