Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352202 - [server][client][push] missing git push for remote
Summary: [server][client][push] missing git push for remote
Status: RESOLVED WONTFIX
Alias: None
Product: Orion
Classification: ECD
Component: Git (show other bugs)
Version: 0.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 353405
Blocks:
  Show dependency tree
 
Reported: 2011-07-15 08:06 EDT by Piotr Janik CLA
Modified: 2015-05-05 16:02 EDT (History)
3 users (show)

See Also:


Attachments
Actions on remote (3.62 KB, image/png)
2011-07-28 06:42 EDT, Tomasz Zarna CLA
no flags Details
mylyn/context/zip (6.54 KB, application/octet-stream)
2011-07-28 06:43 EDT, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Janik CLA 2011-07-15 08:06:37 EDT
There is no global push for remote, which use refspecs stored in a repository config. 
Push available in the Log view allows to push only one branch.
Comment 1 Piotr Janik CLA 2011-07-26 08:03:19 EDT
Proposal:
https://github.com/pjanik/orion.server/tree/bug352202
https://github.com/pjanik/orion.client/tree/bug352202

I wrote all this code and have the rights to contribute it to Eclipse under the
eclipse.org web site terms of use.
Comment 2 Tomasz Zarna CLA 2011-07-27 10:42:15 EDT
Piotrek, could you please rebase your branches? At least the server side one, I'm getting conflicts when merging with master.
Comment 3 Piotr Janik CLA 2011-07-27 17:17:13 EDT
Done. There was ultra-conflict in PushJob with your last changes, so better verify carefully if everything is correct from your side. :)
Comment 4 Tomasz Zarna CLA 2011-07-28 06:38:25 EDT
(In reply to comment #3)
> Done. There was ultra-conflict in PushJob with your last changes, so better
> verify carefully if everything is correct from your side. :)

It looks that you've done well, except 2 lines in PushJob: fields taskService and taskServiceRef can be removed.
Comment 5 Tomasz Zarna CLA 2011-07-28 06:42:58 EDT
Created attachment 200514 [details]
Actions on remote

Pitorek I'm not able to locate the new action. I thought it was supposed to available on a remote, next to Add Remote. Am I missing something?
Comment 6 Tomasz Zarna CLA 2011-07-28 06:43:01 EDT
Created attachment 200515 [details]
mylyn/context/zip
Comment 7 Piotr Janik CLA 2011-07-28 08:33:53 EDT
(In reply to comment #5)
> Actions on remote
> 
> Pitorek I'm not able to locate the new action. I thought it was supposed to
> available on a remote, next to Add Remote. Am I missing something?

It's next to the "Fetch Remote". Its tooltip is "Push Remote". You have to look one level deeper. ;)
Comment 8 Piotr Janik CLA 2011-07-28 08:35:36 EDT
(In reply to comment #4)
> It looks that you've done well, except 2 lines in PushJob: fields taskService
> and taskServiceRef can be removed.

Thx, server branch updated.
Comment 9 Tomasz Zarna CLA 2011-07-29 07:29:03 EDT
I'm sorry but it doesn't work for me, at least not as I would expect. Here are steps I followed in the client:
1. Create two clones of the same repo
2. Make sure they have at least two remote branches and that they're in sync
3. In the first clone, make changes on both branches and commit them, do not push yet
4. Go to Repos page and click Push on the remote
5. On the same page, on the second clone, drill down to its remote, do "Fetch"
6. Merge the fetched changes, or checkout those branch and examine if the changes made in 3. are there
=> SHOULD BE: changes from both branches should be available (pushed in 4. and then fetched in 5.)
=> IS: only change from the branch that was active while pushing (4.) are available

Please note that I haven't checked what actually took place within those clone with git bash. Neither I've prepared a test case that would mimic the steps. Maybe I simply missed something obvious in the UI, but I have a gut feeling that something is wrong.
Comment 10 Piotr Janik CLA 2011-07-29 07:33:42 EDT
Yes, you missed something.
"git push remote_name" pushes only HEAD when there is no config entry "remote.remote_name.push" with refspec. I suppose that you haven't configured such thing, so only HEAD was pushed. It's expected behavior of Git, even covered by my test case afair.

If you want to have all branches pushed, add "remote.remote_name.push" entry with value "refs/heads/*:refs/heads/*" (it's only one example).
Comment 11 Tomasz Zarna CLA 2011-07-29 08:00:09 EDT
(In reply to comment #10)
> "git push remote_name" pushes only HEAD when there is no config entry
> "remote.remote_name.push" with refspec. 

That's funny, because it doesn't work like that in my case. Here's the result of doing the same steps as in comment 9, but this time in git bash:

$ git push origin
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 468 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
To d:/temp/test.git
   9ed21bd..ebd9d18  master -> master
   2529cc0..a429642  test -> test

Notice two branches being pushed.

And my config looks like this:
[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
	hideDotFiles = dotGitOnly
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = d:/temp/test.git
[branch "master"]
	remote = origin
	merge = refs/heads/master
[branch "test"]
	remote = origin
	merge = refs/heads/test

No sign of "remote.remote_name.push".

Anyways, even if you're right I think the action should be more descriptive if the config entry hasn't been set. A tip saying that only the current branch will be pushed and an info where to change that would safe others from the confusion, which I agree is caused by not knowing how the operation works in detail.
Comment 12 Tomasz Zarna CLA 2011-07-29 08:03:17 EDT
I've also noticed that the tests you've added fail when rebased with latest changes by Szymon. It seems that all you need to do to make them turn green again is use ProtocolConstants.KEY_FULL_NAME in your assertions. Could you please update them?
Comment 13 Piotr Janik CLA 2011-07-29 08:17:02 EDT
Ok, case is strange. There are two cases:
1. When I have two branches: master and newbranch, and newbranch wasn't earlier pushed to the remote - only master is pushed after "git push origin".
2. When newbrach exist on the remote - both branches are pushed.

However, look at JGit code:

PushCommand.call() {
[ ... ]
if (refSpecs.isEmpty()) {
  RemoteConfig config = new RemoteConfig(repo.getConfig(),
  getRemote());
  refSpecs.addAll(config.getPushRefSpecs());
}
if (refSpecs.isEmpty()) {
 Ref head = repo.getRef(Constants.HEAD);
 if (head != null && head.isSymbolic())
  refSpecs.add(new RefSpec(head.getLeaf().getName()));
}
[...]
That's the reason. I was reading it earlier and probably verified only with case 1 from Git bash.
Comment 14 Tomasz Zarna CLA 2011-07-29 08:24:57 EDT
(In reply to comment #13)
> 2. When newbrach exist on the remote - both branches are pushed.

Take a look at step 2. in comment 9.

> However, look at JGit code:

I'm pretty sure, we both know we should not treat JGit as a reference implementation ;)
Comment 15 Piotr Janik CLA 2011-07-29 08:28:54 EDT
Tests updated.
Comment 16 Tomasz Zarna CLA 2011-07-29 12:18:29 EDT
Have you referenced bug 353405 and bug 353406 in the code?
Comment 17 Tomasz Zarna CLA 2011-08-02 06:07:58 EDT
I decided to hold off with releasing the change until bug 353405 is fixed. This makes bug 353406 invalid as it never actually existed.
Comment 18 Tomasz Zarna CLA 2011-09-22 09:15:09 EDT
This is still blocked by bug 353405 in JGit. If it's not fixed within a week or so I will change the target to 0.4. To match the reality.
Comment 19 John Arthorne CLA 2011-10-14 15:24:51 EDT
Just so I understand correctly, would this allow pushing to multiple remotes at once?
Comment 20 Tomasz Zarna CLA 2011-10-17 04:05:02 EDT
No, the bug is about being able to push to a single remote. The problem here is that current implementation of JGit doesn't work as expected, ie. it doesn't push to branches that already exist on the remote. It does it only for the current branch. This is quite different from what you would expect by running "git push origin" in the console, it pushes changes from all local branches that exist remotely. This could be fixed in configuration but I'd rather wait for a fix in JGit.

Paraphrasing your question: this would allow pushing to multiple branches of a single remote at once.
Comment 21 John Arthorne CLA 2015-05-05 15:49:16 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html
Comment 22 John Arthorne CLA 2015-05-05 16:02:13 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html