When performing repo sync it pulls the latest commit from a branch even though it is specified to be a specific commit in the manifest xml file. Why is this happening?
The manifest xml file is revision controlled in a repository called repo_example_manifest which has two commits:
Here is the manifest xml file I have called default.xml in the older commit (tagged as "v1.0"):
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="organization"
fetch="https://github.com/organization" />
<project path="bsp" name="repo_example_bsp" remote="organization" revision="master" >
</project>
<project path="app" name="repo_example_app" remote="organization" revision="d3cf9feae739666b1e302f4831eca432afd746fd" />
</manifest>
Here is the manifest xml file in the latest commit (tagged as "v2.0"):
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="orgnanization"
fetch="https://github.com/orgnanization" />
<project path="bsp" name="repo_example_bsp" remote="orgnanization" revision="master" >
</project>
<project path="app" name="repo_example_app" remote="orgnanization" revision="89ba93c3ed67cc45d31aedcb9db47d3ea66fb9a1" />
</manifest>
As you can see, I simply have two repositories that I manage with git-repo:
I just did this as an example to play a bit with git-repo before I integrate it with my company's projects.
Under the repository "repo_example_app" I have two commits. The most recent commit is 89ba93c3ed67cc45d31aedcb9db47d3ea66fb9a1 and the oldest commit is: d3cf9feae739666b1e302f4831eca432afd746fd.
I did the following in bash when I was in the oldest commit (tagged as "v1.0") in repo_example_manifest:
$ repo init -u https://github.com/organization/repo_example_manifest
The output was:
Downloading manifest from https://github.com/organization/repo_example_manifest
repo has been initialized in C:\Users\Eyal\Documents\repo_example_manifest
Downloading Repo source from https://gerrit.googlesource.com/git-repo
Then I sent the command:
repo sync
and the output was:
repo sync has finished successfully.
The result is that both repos have been pulled and appear now in my files system:
So far so good...
BUT, the problem is that the commit pulled under the repository "repo_example_app" which is under the folder "app" is commit number 89ba93c3ed67cc45d31aedcb9db47d3ea66fb9a1 which is the newest commit instead of the commit d3cf9feae739666b1e302f4831eca432afd746fd as written in the XML file.
Can someone explain to me what am I doing wrong here?
I did some more digging and found that someone asked a similar question and the answers provided there actually solved my problem. The answers that I relied on to resolve my issue is:
Let me elaborate a little bit more:
There is no need to transition from one commit to another on the repository that manages the manifest "repo_example_manifest" in order to sync. That won't work.
Instead, to "transition" from one version of the manifest to another you must use repo init
.
In my case, I used repo init -u https://github.com/organization/repo_example_manifest
but with the addition of -b <LOCATION>
.
LOCATION can be either:
refs/tags/<tagname>
After you do repo init -u https://github.com/organization/repo_example_manifest -b <LOCATION>
simply type repo sync
and it works like a charm.