petemoore / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 1 forks source link

If "repo start newbranch" fails partway through, recovery is annoying #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reported by Christopher Tate <ctate@google.com> on Fri Apr 10 11:29:10 PDT 2009
Source: JIRA REPO-22

Here's the situation I was in that I had to recover from:

0. I was working in a topic branch called "oldbranch", and in one package I
had made some edits that had not yet been committed.
1. From the top level, I typed "repo start newbranch"
2. The branch was successfully started and made current in fifty-ish packages,
but then when it got to the package in which I had uncommitted edits, branch
creation failed and repo errored out.

At this point, the repo was in a badly mixed state:  newbranch had been
created and made current in half the repository, but oldbranch was still
current in the other half.  The desired final state here was that newbranch be
created and made current in the entire repo.  Here's what I did to recover:

3. cd to the package in which I had uncommitted edits, "git commit -a" to
commit them.
4. cd back to the top of the repo, and reran "repo start newbranch".  This
errored out immediately, saying that the branch already existed.
5. I typed "repo abandon newbranch" to blow away the new branch in all the
packages in which it had been successfully created
6. I then typed "repo start newbranch" again, which finally set up the new
branch everywhere.

IMHO the biggest problem here was that Step 4 failed; I don't see why it
should be an error to attempt to (create and make current) a branch that
happens to already exist in some packages.  At worst this might be a noop,
right?  And the rest of the time, it would do exactly what I was attempting:
taking a partial-branch-existence state and making it more universal.

Original issue reported on code.google.com by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:10

GoogleCodeExporter commented 9 years ago
Comment by Shawn Pearce <sop@google.com> on Fri Apr 10 11:34:18 PDT 2009

Actually, two things should be fixed:

- #1 should have errored out if the switch wouldn't go cleanly anyway in at
least one project.  This mirrors with behavior in "git checkout -b".

- As you state, #4 shouldn't have errored out.

Fixing #4 is easier than #1.

Original comment by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:10

GoogleCodeExporter commented 9 years ago
Update by Shawn Pearce <sop@google.com> on Fri Apr 10 13:49:27 PDT 2009

Original comment by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:10

GoogleCodeExporter commented 9 years ago
Update by Shawn Pearce <sop@google.com> on Fri Apr 10 13:49:29 PDT 2009

Original comment by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:11

GoogleCodeExporter commented 9 years ago
Comment by Shawn Pearce <sop@google.com> on Fri Apr 10 16:25:32 PDT 2009

Fixed by https://review.source.android.com/9500

Original comment by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:11

GoogleCodeExporter commented 9 years ago
Update by Shawn Pearce <sop@google.com> on Fri Apr 10 16:25:32 PDT 2009

Fixed in version 1.6.5.

Original comment by code-rev...@gtempaccount.com on 24 Sep 2009 at 9:11