[GeoNetwork-devel] Commit git problematic

Hi,

I am adding the mailing to this conversation so people can learn from it.

I am having to learn a little about submodules as well and am slowly getting used to it.

There are a few things to remember

  1. The submodules are cloned as read-only so that anyone can clone the main repository
  2. When a submodule is checked out it is in detached head state which means it is not on a branch.

As I see it there are 2 ways of working on a submodule.

  1. Checkout the submodule as read-only in a separate folder and work on it there and commit using that branch
  2. Each time you want to edit a submodule make it read-write, make and push change, make it read-only again.

Here are the steps for the two methods:

=== Separate clone of submodule ===
(not tested)

Note this example only shows how to do the work on one branch so if you want the commit on 2.8.x as well you have to cherry-pick the commit to that branch and update the references on core-geonetwork 2.8.x branch as well.

  1. edit submodule
  2. commit and push submodule
  3. switch to core-geonetwork
  4. git submodule update
  5. git status (if it works as expected it should show that the submodule has changed)
  6. git add
  7. git commit -m “updated submodule reference to contain commit with the bug fix …”
  8. git push

=== Edit submodule in place ===

(tested)

  1. edit .gitmodules (change git://github.com/ to git@anonymised.com:slight_smile:
  2. git sync
  3. git update
  4. cd submodule
  5. git checkout master (or 2.8.x)
  6. make changes and commit
  7. git checkout 2.8.x
  • (if you want the change on 2.8.x as well)1. git log master
  • find commit you want to merge to 2.8.x1. git cherry-pick
  1. git push
  • (will push changes to both 2.8.x and master)1. cd …
  • (back to core)1. git checkout 2.8.x
  • (submodule is on 2.8.x now so you need to update 2.8.x reference)1. git add
  1. git commit -m “updated submodule reference to contain commit with the bug fix …”
  2. git checkout master
  3. cd submodule
  4. git checkout master
  5. cd …
  6. git add
  7. git commit -m “updated submodule reference to contain commit with the bug fix …”
  8. git co – .gitmodules (revert .gitmodules to read-only urls again)
  9. git submodule sync
  10. git submodule update

I will try to make some video tutorials for these workflows when I have time. I will also try out some of the tools.

Jesse

On Tue, Jun 19, 2012 at 9:55 PM, Jose Garcia <jose.garcia@anonymised.com> wrote:

Hi Jesse

Trying to commit in docs submodule I get this:

Pushing to git://github.com/geonetwork/core-doc-sources.git

fatal: remote error:

You can’t push to git://github.com/geonetwork/core-doc-sources.git

Use git@anonymised.com.:geonetwork/core-doc-sources.git

Any idea? I tried with 2 different Git apps and same error.

Thanks and regards,

Jose García


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net

Hi Jesse, I've tested one of the method

2012/6/20 Jesse Eichar <jesse.eichar@anonymised.com>:

Hi,

I am adding the mailing to this conversation so people can learn from it.

I am having to learn a little about submodules as well and am slowly getting
used to it.

There are a few things to remember

1. The submodules are cloned as read-only so that anyone can clone the main
repository
2. When a submodule is checked out it is in detached head state which means
it is not on a branch.

As I see it there are 2 ways of working on a submodule.

1. Checkout the submodule as read-only in a separate folder and work on it
there and commit using that branch
2. Each time you want to edit a submodule make it read-write, make and push
change, make it read-only again.

Here are the steps for the two methods:

=== Separate clone of submodule ===
(not tested)

Note this example only shows how to do the work on one branch so if you want
the commit on 2.8.x as well you have to cherry-pick the commit to that
branch and update the references on core-geonetwork 2.8.x branch as well.

I tested that option :

edit submodule
commit and push submodule
switch to core-geonetwork

git submodule update

this made nothing.

but
cd submodule
git pull origin master
cd ..

git status (if it works as expected it should show that the submodule has
changed)
git add <submodule directory>
git commit -m "updated submodule reference to contain commit with the bug
fix ...."
git push

And it works.

Francois

=== Edit submodule in place ===
(tested)

edit .gitmodules (change git://github.com/ to git@anonymised.com:)
git sync
git update
cd submodule
git checkout master (or 2.8.x)
make changes and commit
git checkout 2.8.x

(if you want the change on 2.8.x as well)

git log master

find commit you want to merge to 2.8.x

git cherry-pick <commit>
git push

(will push changes to both 2.8.x and master)

cd ..

(back to core)

git checkout 2.8.x

(submodule is on 2.8.x now so you need to update 2.8.x reference)

git add <submodule>
git commit -m "updated submodule reference to contain commit with the bug
fix ...."
git checkout master
cd submodule
git checkout master
cd ..
git add <submodule>
git commit -m "updated submodule reference to contain commit with the bug
fix ...."
git co -- .gitmodules (revert .gitmodules to read-only urls again)
git submodule sync
git submodule update

I will try to make some video tutorials for these workflows when I have
time. I will also try out some of the tools.

Jesse

On Tue, Jun 19, 2012 at 9:55 PM, Jose Garcia <jose.garcia@anonymised.com> wrote:

Hi Jesse

Trying to commit in docs submodule I get this:

Pushing to git://github.com/geonetwork/core-doc-sources.git

fatal: remote error:

  You can't push to git://github.com/geonetwork/core-doc-sources.git

  Use git@anonymised.com:geonetwork/core-doc-sources.git

Any idea? I tried with 2 different Git apps and same error.

Thanks and regards,

Jose García

--
GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on
GeoServer and GeoNetwork. Visit http://geocat.net for details.
_________________________
Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork