Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349375 - [server] Ability to delete remote branches
Summary: [server] Ability to delete remote branches
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Git (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 0.3 M1   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard: gsoc2011
Keywords:
Depends on:
Blocks: 351458
  Show dependency tree
 
Reported: 2011-06-14 16:58 EDT by John Arthorne CLA
Modified: 2012-01-19 10:57 EST (History)
2 users (show)

See Also:
tomasz.zarna: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2011-06-14 16:58:13 EDT
It should be possible to delete a remote branch in the Orion Git client. This is equivalent to the command line:

git push origin :branch-name
Comment 1 Piotr Janik CLA 2011-07-22 11:11:20 EDT
https://github.com/pjanik/orion.client/commits/bug349375
https://github.com/pjanik/orion.server/commits/bug349375

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-25 07:35:29 EDT
Both commits look good. I would just extend the test case with few lines where from a secondary clone you verify that the removed branch is gone. Moreover, if the branch is already tracked locally, an assertion for pulling the removed branch, which should fail, would be nice to have as well.
Comment 3 Piotr Janik CLA 2011-07-25 10:34:48 EDT
(In reply to comment #2)
> Both commits look good. I would just extend the test case with few lines where
> from a secondary clone you verify that the removed branch is gone. Moreover, if
> the branch is already tracked locally, an assertion for pulling the removed
> branch, which should fail, would be nice to have as well.
I don't understand - what secondary clone? There is no secondary clone. 
Do you want to have something like double check? I can do it using JGit API but... is really necessary or even useful for this test case? 
In my opinion - not. I list all remote branches, check their quantity and even names. I think that sufficient for such simple test case.
Comment 4 Tomasz Zarna CLA 2011-07-25 11:36:07 EDT
A secondary clone - a second clone of the same repo. Double checking if the branch is gone in the secondary clone would assure us that the change is actually pushed to the origin and we're not mislead by a false image of the remote in the first clone.
Comment 5 Piotr Janik CLA 2011-07-25 12:13:22 EDT
(In reply to comment #4)
> A secondary clone - a second clone of the same repo. Double checking if the
> branch is gone in the secondary clone would assure us that the change is
> actually pushed to the origin and we're not mislead by a false image of the
> remote in the first clone.
I'm not sure if I understand it.. Do you want to create secondary clone and just do the same thing - list it's remote branches?
Comment 6 Tomasz Zarna CLA 2011-07-25 12:35:46 EDT
(In reply to comment #5)
> Do you want to create secondary clone and just
> do the same thing - list it's remote branches?

That would fail, because you need to fetch first. And this is what I miss in the single clone case.

1. Clone a repo -> clone#1
2. Clone#1: create a branch, push it
3. Clone a repo -> clone#2
4. Clone#2: check if the branch is available
5. Clone#1: remove the branch/push
6. Clone#1: check if the branch is gone
7. Clone#2: fetch, check if the branch is gone

In comment 2, I mentioned an alternate scenario:

1. Clone a repo -> clone#1
2. Clone#1: create a branch, push it
3. Clone a repo -> clone#2
4. Clone#2: check if the branch is available
5. Clone#2: checkout the branch
6. Clone#1: remove the branch/push
7. Clone#1: check if the branch is gone
8. Clone#2: pull, should fail, check result
Comment 7 Piotr Janik CLA 2011-07-25 14:34:10 EDT
1. Are you able to implement scenario 1 in the Orion?
2. Are you able to reproduce scenario 1 even in the console?
3. Are you able to implement scenario 2 in the Orion?

In my opinion:
1. Unfortunately not. To do these you need "git remote prune origin".
2. Unfortunately not. Git REST API doesn't contain "git remote prune origin" equivalent. 
3. Unfortunately not. Git REST API doesn't contain "git pull".

Apart from that, general question - what are we testing in fact? Orion, JGit or both of them?
I've made small change to support empty srcref. If answer is Orion - I think that we should test if Orion accepts such request (as it used to refuse such requests), if JGit command is actually called and if proper response is returned. This is area of Orion responsibility. JGit takes care of the rest of actions.
Your tests cases - ofc they are useful, nice, tests a lot, but I think that is rather JGit testing than Orion.

Don't get me wrong. I wanted and tried to implement it - but I couldn't manage because of mentioned problems. I think that next X minutes/hours spent on trying to resolve these problems isn't just worth of it, as it's not Orion testing imho.
Comment 8 Piotr Janik CLA 2011-07-25 14:45:42 EDT
Scenario 2 with JGit call for Pull is possible (if you such solution is satisfactory for you).
Comment 9 Piotr Janik CLA 2011-07-26 05:21:05 EDT
New version: https://github.com/pjanik/orion.server/tree/bug349375
It's almost scenario 2 (fetch instead of pull). I hope that it will be sufficient.