JetBrains / bunches

Set of utils for supporting patchsets branches
Apache License 2.0
21 stars 14 forks source link

Incorrect behavior in project with multiple VCS roots #16

Closed ddolovov closed 5 years ago

ddolovov commented 5 years ago

Consider the following case:

bunch command will not work correctly on such configuration.

Examples:

Checkout 2 projects:

git clone https://github.com/ddolovov/bunches-root-project.git root
git clone https://github.com/ddolovov/bunches-nested-project.git root/nested

Check stats in nested:

bunch stats root/nested

Number of affected origin files: 1

Ext   |exists |   del | total
all   |     1 |     0 |     1
183   |     0 |     0 |     0
191   |     1 |     0 |     1
cd ..

Looks correct.

Check stats in root:

bunch stats root

Number of affected origin files: 2

Ext   |exists |   del | total
all   |     2 |     0 |     2
183   |     0 |     0 |     0
191   |     2 |     0 |     2

Error: It counts bunch files in both VCS roots.

Now switch to 191 and check how it works:

bunch switch root 191
git -C root log --oneline

bdcf65e (HEAD -> master) ~~~~ switch 191 ~~~~
3bd9f67 (origin/master, origin/HEAD) Update .gitignore
cd212e4 Initial commit

git -C root status

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Looks good.

What about nested?

git -C root/nested log --oneline

debd5f6 (HEAD -> master, origin/master, origin/HEAD) Initial commit

git -C root/nested status

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   file-in-nested-project.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    file-in-nested-project.txt.183

no changes added to commit (use "git add" and/or "git commit -a")

Error: Files were switched but there is no commit.