Updating submodule to tag

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating submodule to tag

SmartGit mailing list
I have a submodule that needs to be updated.  I'm not tyring to change anything in the submodule.  But there are changes on its source that I want to pull.  I cannot figure out how to do it through SmartGit.

I manually gone to its folder and run the command:
git checkout tag/{name of tag}

That updates the submodule to the correct tag.

SmartGit then indicates that folder has a change.  I commit it, but try to push and get the error:

$ git.exe push --porcelain --progress --recurse-submodules=check origin refs/heads/dev:refs/heads/dev/library/Zend
The following submodule paths contain changes that can not be found on any remote:
Please try
 git push --recurse-submodules=on-demand
or cd to the path and use
 git push
to push them to a remote.

Next, I try to manually push according to the instructions.  In the command line, I go to the root of my project and run "git push --recurse-submodules=on-demand" and get the error:

Pushing submodule 'library/Zend'
fatal: You are currently not on a branch.
To push the history leading to the current (detached HEAD)
state now, use
  git push origin HEAD:(name-of-branch)
unable to push submodule 'library/Zend'
fatal: Failed to push all needed submodules!
Unexpected end of command stream

What am I doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Updating submodule to tag

SmartGit mailing list
> I have a submodule that needs to be updated.  I'm not tyring to change anything in
> the submodule.  But there are changes on its source that I want to pull.  I cannot
> figure out how to do it through SmartGit.

Open the Log on the submodule directory, select the appropriate commit there and invoke Check Out.

> Pushing submodule 'library/Zend'
> fatal: You are currently not on a branch.
> To push the history leading to the current (detached HEAD)
> state now, use
>   git push origin HEAD:(name-of-branch)
> unable to push submodule 'library/Zend'
> fatal: Failed to push all needed submodules!
> Unexpected end of command stream
>
> What am I doing wrong?

When checking out the tag, be sure to create a branch (there is an option to do that in SmartGit), then push the branch. Actually, it will be sufficient to have a branch pushed which *contains* the tag commit, so the --recurse-submodules=check will succeed.

--
Best regards,
Marc Strapetz
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/11/2015 21:10 - [hidden email] [smartgit] wrote:

> I have a submodule that needs to be updated.  I'm not tyring to change anything in
> the submodule.  But there are changes on its source that I want to pull.  I cannot
> figure out how to do it through SmartGit.
>
> I manually gone to its folder and run the command:
> git checkout tag/{name of tag}
>
> That updates the submodule to the correct tag.
>
> SmartGit then indicates that folder has a change.  I commit it, but try to push
> and get the error:
>
> $ git.exe push --porcelain --progress --recurse-submodules=check origin
> refs/heads/dev:refs/heads/dev/library/Zend
> The following submodule paths contain changes that can not be found on any remote:
> Please try
>  git push --recurse-submodules=on-demand
> or cd to the path and use
>  git push
> to push them to a remote.
>
> Next, I try to manually push according to the instructions.  In the command line,
> I go to the root of my project and run "git push --recurse-submodules=on-demand"
> and get the error:
>
> Pushing submodule 'library/Zend'
> fatal: You are currently not on a branch.
> To push the history leading to the current (detached HEAD)
> state now, use
>   git push origin HEAD:(name-of-branch)
> unable to push submodule 'library/Zend'
> fatal: Failed to push all needed submodules!
> Unexpected end of command stream
>
> What am I doing wrong?
>
Reply | Threaded
Open this post in threaded view
|

Re: Updating submodule to tag

SmartGit mailing list
I was able to check out the tag for that submodule, and make my own branch for it.  Thanks for that.

I'm a little confused when you say "push the branch".  Right-clicking the branch I created and trying to push does not work.  Which makes sense because that submodule's origin is not code that I maintain.

In my project I can commit this change.  But pushing from my project's root gives me a similar error:

$ git.exe push --porcelain --progress --recurse-submodules=check origin refs/heads/dev:refs/heads/dev
  library/Zend
The following submodule paths contain changes that can not be found on any remote:
Please try
 git push --recurse-submodules=on-demand
or cd to the path and use
 git push
to push them to a remote.
Reply | Threaded
Open this post in threaded view
|

Re: Updating submodule to tag

SmartGit mailing list
> I'm a little confused when you say "push the branch".  Right-clicking the branch I
> created and trying to push does not work.  Which makes sense because that
> submodule's origin is not code that I maintain.

If you don't push your local change to the submodule, how would another user be able to fetch/clone your main repository?

Hence, you will have to push your local changes to some additional remote repository, preferably located on the same server as your main remote repository.

--
Best regards,
Marc Strapetz
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com


02/13/2015 18:40 - [hidden email] [smartgit] wrote:

> I was able to check out the tag for that submodule, and make my own branch for it.
>  Thanks for that.
>
> I'm a little confused when you say "push the branch".  Right-clicking the branch I
> created and trying to push does not work.  Which makes sense because that
> submodule's origin is not code that I maintain.
>
> In my project I can commit this change.  But pushing from my project's root gives
> me a similar error:
>
> $ git.exe push --porcelain --progress --recurse-submodules=check origin
> refs/heads/dev:refs/heads/dev
>   library/Zend
> The following submodule paths contain changes that can not be found on any remote:
> Please try
>  git push --recurse-submodules=on-demand
> or cd to the path and use
>  git push
> to push them to a remote.
>
Reply | Threaded
Open this post in threaded view
|

Re: Updating submodule to tag

WORMSS
It seems, the problem may lay in --recurse-submodules=check

If the only thing referencing a certain commit is a tag on a submodule, then what ever code Git uses to make sure that commit exists on the submodule it is not taking in tags into account.

This is why he wants you to make a branch that refers to that commit on the submodule.. As you have said, you do not have access to that. The only other thing would be to run the same command but without --recurse-submodules=check

This will remove the checking, but obviously you can be in serious doodoo if you are not 100% sure that the commit exists on the remote repo the submodule is referring too.

- Colin
Reply | Threaded
Open this post in threaded view
|

Re: Updating submodule to tag

SmartGit mailing list
In reply to this post by SmartGit mailing list
> If you don't push your local change to the submodule, how would another user be able to fetch/clone
> your main repository?

Sorry I may have not been clear.  This submodule is a library (Zend Framework) needed for my project.  But it's a library maintained by others, that I cannot modify.  All I want to do is upgrade my project's version of it by making the submodule point to a different tag in the origin.

In any case, using the log to check out a tag into its own branch, then Wormss suggestions of removing "--recurse-submodules=check" worked.  I manually used "git push" from the command line since i couldn't not see how to do that from SmartGit.

Submodules seems to be a bit confusing for lots of folks.  If SmartGit were able to simplify things I'm sure lots of developers would appreciate it :)

Thanks all.