Submit a change based on a change with repo and git

37 views
Skip to first unread message

Johan de Koning

unread,
Jul 27, 2009, 5:16:34 PM7/27/09
to Repo and Gerrit Discussion
For the Android source tree I want to submit a change based on another
change. I did this before and it was working fine. The dependency
between the changes where visible on the review server and also the
download went well.

But now when I follow the same procedure some "merge" change is added
depending on the existing change and needed by my new change. So my
question is what is the normal procedure to submit a change based on a
change.

Steps that I take. I have a project called platform/vendor/htc/dream-
open. I downloaded the cupcake branch version with repo sync. There is
a change 9828 which I want to use to depend my change on.

repo download platform/vendor/htc/dream-open 9828

I cannot do a repo start now because I get some warning that I am not
working on a clean build. So first I make a development branch inside
the local vendor/htc/dream-open directory

git checkout -b branch9828

Then I start a topic branch with repo start

repo start default platform/vendor/htc/dream-open

I merge the branch9828 into the default branch

git merge branch9828

The branch9828 is not needed anymore. So i delete it

git branch -d branch9828

I edit the files for my own change. With repo status and git diff I
see the correct differences

Because I did not add any files I perform

git commit -a

and supply a message

My keys are already set correctly so I upload the change now with

repo upload

Previously I got a message like this

Upload project vendor/htc/dream/:
branch ownbranch ( 4 commits, Wed Jun 24 23:08:24 2009 +0200):
0c35fa84 Add /system/lib/libhtc_acoustic.so to the list of
needed proprietary files. Without it, audio does not play in Android
1.5.
c93fac29 Whoops, fix file permission touched by editor.
b15e33c5 Added more proprietary libraries.
6aab35e0 Added more proprietary libraries.
to review.source.android.com (y/n)?

For which 6aab35e0 is my change. But when I perform the steps again I
got something like this

Upload project vendor/htc/dream-open/:
branch refs/for/cupcake ( 5 commits, Mon Jul 27 23:13:31 2009
+0200):
0c35fa84 Add /system/lib/libhtc_acoustic.so to the list of
needed proprietary files. Without it, audio does not play in Android
1.5.
c93fac29 Whoops, fix file permission touched by editor.
b15e33c5 Added more proprietary libraries.
aa647b38 Merge branch 'branch9828' into default
e5914f3b Added more proprietary libraries.
to review.source.android.com (y/n)?

There are now two changes visible. When I upload those changes the
branch9828 change is an empty one.

Is this how it should be (because then you get a lot of empty changes)
or do I take some wrong steps? Hope somebody can give me more details
about the submitting changes procedure.

Shawn Pearce

unread,
Jul 27, 2009, 6:07:59 PM7/27/09
to repo-d...@googlegroups.com
The merge created that empty commit, because the new branch called
"default" made by repo start is on a newer version of code than the
change 9828 was based on.

To avoid that merge commit you would actually want to do a hard reset
to 9828, so instead of saying "git merge branch9828" you would instead
say "git reset --hard branch9828". However, this is a potentially
dangerous operation as it overwrites any modified working tree files,
so if you have uncommitted changes they would be destroyed by this
command. Stash them with "git stash" or commit them to another
temporary branch, so you can recover them after the hard reset.

Johan de Koning

unread,
Jul 28, 2009, 1:30:16 AM7/28/09
to Repo and Gerrit Discussion
Thanks. That is working.
Reply all
Reply to author
Forward
0 new messages