git-upstream fails to create merge if no local commits are found

Bug #1367985 reported by Jonathan Harker
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
git-upstream
Status tracked in Trunk
0.12
Fix Released
Undecided
Unassigned
Trunk
Fix Released
Medium
Darragh Bailey

Bug Description

If there are changes in `upstream/master` that have not yet been merged into `local/master` but no changes being carried locally, then git-upstream will fail to merge upstream changes into the local branch.

Expected result: a simple merge of `upstream/master` into `local/master`

Actual result: no changes are made to `local/master`

% git upstream import --force --into local/master upstream/master
Searching for previous import
Starting import of upstream
Successfully created import branch
There are no local changes to be applied!
Import cancelled

Changed in git-upstream:
importance: Undecided → Low
importance: Low → Medium
status: New → Confirmed
Revision history for this message
Matthew Gilliard (matthew-gilliard-u) wrote :

I am having trouble replicating the exact situation you are describing. If you could give more detail about how to replicate that would be very helpful.

That said - if you have no local changes then I'm not sure git upstream is the right tool to be using. You ought to be able to just use 'git merge upstream/master local/master' or similar, and there won't be any conflicts. Nothing is being merged or rebased, because there's only a linear history which you're moving your branches along. I wonder if I've misunderstood what you're trying to do...?

Changed in git-upstream:
status: Confirmed → Incomplete
Revision history for this message
Jonathan Harker (jesusaurus) wrote :

My local/master branch is ideally very small, and changes from local/master eventually get applied to upstream/master. So in the event that all changes from local/master have merged into upstream/master, then git-upstream no longer has any effect on local/master even though I would like to keep it up-to-date with upstream/master. I don't see why my workflow should be dependent on whether or not I have any local changes. I expect git-upstream to keep a downstream branch in sync with an upstream branch regardless of the state of the git history. But perhaps my expectation here is wrong, and I should make my tooling around its use keep track of the state of git's history.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for git-upstream because there has been no activity for 60 days.]

Changed in git-upstream:
status: Incomplete → Expired
Changed in git-upstream:
status: Expired → Confirmed
Changed in git-upstream:
assignee: nobody → Darragh Bailey (dbailey-k)
Revision history for this message
Darragh Bailey (dbailey-k) wrote :

Somewhat related to this is the problem where if there is nothing changed upstream, then git-usptream should skip re-importing the same upstream and applying the local changes on top.

I have a solution for this part, which I believe should make it reasonably easy to fix this specific case where there are no changes to carry as well.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to git-upstream (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/332915

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to git-upstream (master)

Fix proposed to branch: master
Review: https://review.openstack.org/337161

Changed in git-upstream:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to git-upstream (master)

Reviewed: https://review.openstack.org/332915
Committed: https://git.openstack.org/cgit/openstack/git-upstream/commit/?id=90bf42d5d68598663e7910836f72391bcc019421
Submitter: Jenkins
Branch: master

commit 90bf42d5d68598663e7910836f72391bcc019421
Author: Darragh Bailey <email address hidden>
Date: Wed Jun 22 15:51:50 2016 +0100

    Detect when nothing to import

    Look at the upstream and additional branches to determine if there are
    any new commits compared with what was previously imported, and skip
    the upstream import if given the same inputs.

    Move the detection code into the library for reuse.

    Change-Id: I50e6d6c10c4033ed0da599eb54404e83b6274845
    Related-Bug: #1367985

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to git-upstream (master)

Reviewed: https://review.openstack.org/337161
Committed: https://git.openstack.org/cgit/openstack/git-upstream/commit/?id=e231483adc26a25e3fa3428e98a453de1023d3ed
Submitter: Jenkins
Branch: master

commit e231483adc26a25e3fa3428e98a453de1023d3ed
Author: Darragh Bailey <email address hidden>
Date: Mon Jul 4 11:25:02 2016 +0100

    Handle all local changes landed upstream

    Allow importing an upstream that contains all local changes by simply
    merging to replace the existing target with the upstream branch given.

    In certain workflows it is possible for the local changes to have all
    landed upstream. In such a case, applying of the changes carried should
    detect there is nothing to apply and create import branch to point to
    the upstream branch to allow the standard finish actions to complete.

    Change-Id: I61ae706f2b240a0e2590e03d2e83db97dafdf962
    Closes-Bug: #1367985

Changed in git-upstream:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.