alibaba / git-repo-go

git-repo is a command-line tool for centralized workflow, can work with Gerrit, AGit-Flow compatible servers. It is written in Golang, and it can be installed easily without further dependency. It provides an easy-to-use solution for multiple repositories which is introduced by Android repo first, and it can also work with a single repository.
https://git-repo.info/
Apache License 2.0
262 stars 60 forks source link

'git repo upload' report errors when using latest-ok version #23

Closed guestliu closed 3 years ago

guestliu commented 3 years ago

'Latest-ok version' is a version defined by a manifest file with revisions, like the following release.xml:

<manifest>
  <remote name="origin" fetch=".." review="ssh://git@gitlab.alibaba-inc.com/"></remote>
  <default remote="origin" revision="master" sync-j="8"></default>
  <project name="alicpp2/test-repo1" path="test_repo1" revision="d3c878ac1786e5a6d31b4e8908010580e1f6e584" groups="holo" upstream="master"></project>
  <project name="alicpp2/test-repo2" path="test_repo2" revision="c6d2fa67c86febc802896991414c34c67ea8ee44" groups="holo" upstream="master"></project>
</manifest>

Run the bash to get an error:

#!/bin/bash
SCRIPT_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
cd $SCRIPT_DIR

set -ex

rm -rf repo && mkdir -p repo
cd repo

git repo init -u git@gitlab.alibaba-inc.com:alicpp2/test-repo.git -m release.xml
git repo sync -j 32
git repo start my_patch --all

cd test_repo1
touch ZZZ
git add ZZZ
git commit -m 'a test commit'
echo xxx | git repo upload

image

Expect: Run 'git repo upload' successfully when users work in a repo with latest-ok version.

jiangxin commented 3 years ago

It's not recommend to do like this. Projects with fixed revisions in a manifest.xml should not been changed. If you really want to so, we may:

  1. Define two revision for project in a manifest file. One revision is a fixed revision which is used for checking out the worktree, and another revision should point to a branch which used for user to upload changes.
  2. The worktree will never get chance to be updated, because of the fixed revision. Any changes synced from upstream in local worktree will be treated as changes need to be uploaded to upstream.

Is that what you want?

guestliu commented 3 years ago

It's not recommend to do like this. Projects with fixed revisions in a manifest.xml should not been changed. If you really want to so, we may:

  1. Define two revision for project in a manifest file. One revision is a fixed revision which is used for checking out the worktree, and another revision should point to a branch which used for user to upload changes.
  2. The worktree will never get chance to be updated, because of the fixed revision. Any changes synced from upstream in local worktree will be treated as changes need to be uploaded to upstream.

Is that what you want?

  1. Why 'git pr' works but 'git repo upload' fails?
  2. 'Define two revisions' does not make sense, one revision is the fixed revision and the next one is the newest revision on the branch which is always in change.
  3. 'The worktree will never get chance to be updated' is FALSE. The manifest file(latest_ok_release.xml) may be changed in the remote. When we run 'git repo sync' , we will sync a newest latest-ok version whose revisions are fixed.