modify a Gerrit "change" with a fresh tree (original local branch deleted)

114 views
Skip to first unread message

kostmo

unread,
May 13, 2010, 11:27:17 PM5/13/10
to Repo and Gerrit Discussion
I would like to submit the suggested modifications to this change:
https://review.source.android.com/#change,13370
Normally, I would switch to my branch, "git add" the modified files,
"git commit --amend", and finally "repo upload --replace .".

However, my local copy of the Android project has been deleted since I
originally submitted the change. I have checked out a fresh new copy
of the Android project now. How do I proceed from here?

What I have tried so far is this:
1) Start a new branch: "repo start new_branch_name"
2) Execute the "Download" command listed on Gerrit: "repo download
platform/frameworks/base 13370/2"
3) make the changes
4) "git add"
5) "git commit --amend"
6) "repo upload --replace ."

However, this results in:
"no branches ready for upload"

--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

Shawn Pearce

unread,
May 14, 2010, 10:23:03 AM5/14/10
to kostmo, Repo and Gerrit Discussion
kostmo <kos...@gmail.com> wrote:
> I would like to submit the suggested modifications to this change:
> https://review.source.android.com/#change,13370
> Normally, I would switch to my branch, "git add" the modified files,
> "git commit --amend", and finally "repo upload --replace .".
>
> However, my local copy of the Android project has been deleted since I
> originally submitted the change. I have checked out a fresh new copy
> of the Android project now. How do I proceed from here?
>
> What I have tried so far is this:
> 1) Start a new branch: "repo start new_branch_name"
> 2) Execute the "Download" command listed on Gerrit: "repo download
> platform/frameworks/base 13370/2"
> 3) make the changes
> 4) "git add"
> 5) "git commit --amend"
> 6) "repo upload --replace ."
>
> However, this results in:
> "no branches ready for upload"

That is because the Download command checked out a detached HEAD,
which means it disconnected from the branch you started. Your commit
was updated on the detached HEAD and was never associated with
your branch.

You can resolve that:

Forcefully recreate that new branch from your current state:

$ git branch -f new_branch_name HEAD

Now switch to it, so any further updates go to the branch rather
than the detached HEAD:

$ git checkout new_branch_name

At this point, since the branch has a change in it, you should be
able to repo upload:

$ repo upload --replace .

Karl Ostmo

unread,
May 14, 2010, 7:02:48 PM5/14/10
to Shawn Pearce, Repo and Gerrit Discussion
I'm still getting the same error.

Here is my full, exact sequence of commands and relevant output, starting completely from scratch:

$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
$ cd frameworks/base/
$ repo download platform/frameworks/base 13370/2
$ git branch -f nomedia_branch HEAD
$ git checkout nomedia_branch
$ gedit core/java/android/provider/MediaStore.java
<edit and save file>
$ repo status .
# on branch nomedia_branch
project frameworks/base/                        branch nomedia_branch
 M-     core/java/android/provider/MediaStore.java
$ git add core/java/android/provider/MediaStore.java
$ git commit --amend
<Ctrl+x to exit nano>
[nomedia_branch 04caaf2] Add and document .nomedia constant for MediaStore (Issue 6365)
 2 files changed, 19 insertions(+), 0 deletions(-)
$ repo status .
# on branch nomedia_branch
nothing to commit (working directory clean)

$ repo upload --replace .
no branches ready for upload

What am I doing wrong?

Shawn Pearce

unread,
May 15, 2010, 6:40:53 PM5/15/10
to Karl Ostmo, Repo and Gerrit Discussion
The branch nomedia_branch was created by git branch, not repo start.
There is missing information there that repo wants before it will use
the branch for upload. Perhaps the easiest way to fix that now is to
create a new branch and reset to the same commit:

$ repo start nomedia_branch2 .
$ git reset --hard nomedia_branch
$ git branch -d nomedia_branch

kostmo

unread,
May 16, 2010, 9:02:58 AM5/16/10
to Repo and Gerrit Discussion
Thanks, that worked.

Karl
> There is missing information there that repowants before it will use
Reply all
Reply to author
Forward
0 new messages