hraban / tomono

Multi- To Mono-repository merge
https://tomono.0brg.net
GNU Affero General Public License v3.0
842 stars 138 forks source link

Namepaced tags pushing to remote failure #47

Closed divineniiquaye closed 2 years ago

divineniiquaye commented 2 years ago

Hello @hraban, I have an issue with pushing namespace tags, the issue in a way affects this tool since it produces the namespaces tags. I've tried several ways of pushing namespaced & non-namespaced tags altogether to multi repositories but have been unsuccessful.

Upon several attempts using different methods, I concluded on this ref refs/{remotes/origin,tags/foo,tags}/* which seems to fail. I really need help with this.

hraban commented 2 years ago

I don't think I understand what the actual problem is. I just ran the test script and pushed the resulting repo with tags to github: https://github.com/hraban/test/tags as you can see they're all there.

Can you create a failing test case to demonstrate the issue, so we can sort the problem out?

You can get the test script here:

https://tomono.0brg.net/#tests

Just copy and paste the entire code block, and run it in the same directory as your "tomono" script.

hraban commented 2 years ago

P.S.: Hi to Accra :D a good friend of mine is from there, he's also a coder.

divineniiquaye commented 2 years ago

I don't think I understand what the actual problem is. I just ran the test script and pushed the resulting repo with tags to github: https://github.com/hraban/test/tags as you can see they're all there.

Can you create a failing test case to demonstrate the issue, so we can sort the problem out?

You can get the test script here:

https://tomono.0brg.net/#tests

Just copy and paste the entire code block, and run it in the same directory as your "tomono" script.

Sorry I wasn't clear on my issue.

  1. My monorepo lives in a repo named Foo which has merged repos of A, B, C, and D.
  2. All the merged repo tags are namespaced.
  3. I added a few commits to A, B, and D repos subfolders which exists in monorepo Foo.
  4. I finally added a new non-namespaced tag v2.0 to repo Foo.

The issue I'm faced with is, that I want to push both the namespaced tags belonging to a particular repo as non-namespaced with includes the newly added tag v2.0.

So an example for repo A when pushed should I should expect a tag of:

However, this is not the case and will really need help on this.

hraban commented 2 years ago

I tried to put an example in a script:

#!/usr/bin/env bash

set -euo pipefail
set -x

d="$(mktemp -d)"
cd "$d"
mkdir repo-a
(
    cd repo-a
    git init
    echo hello > test
    git add -A
    git commit -m 'root commit for repo-a'
    git tag root @
    git commit --allow-empty -m 'second commit for repo-a'
    git tag v1.0
    git commit --allow-empty -m 'third commit for repo-a'
    git tag v1.5
    git commit --allow-empty -m 'fourth commit for repo-a'
    git tag v1.8
)

mkdir repo-b
(
    cd repo-b
    git init
    echo hello > test
    git add -A
    git commit -m 'root commit for repo-b'
    git tag root @
    git commit --allow-empty -m 'second commit for repo-b'
)

mkdir repo-c
(
    cd repo-c
    git init
    echo hello > test
    git add -A
    git commit -m 'root commit for repo-c'
    git tag root @
    git commit --allow-empty -m 'second commit for repo-c'
)

for x in a b c ; do echo "$PWD/repo-$x $x" ; done | tomono

(
    cd core
    git tag v2.0
    git remote add gh git@github.com:hraban/test
    git push -f --mirror --no-verify gh
)

It seems to work: https://github.com/hraban/test/tags has a tag v2.0:

image

Can you adapt the script to show me where tomono doesn't work?

hraban commented 2 years ago

Hi Divine,

I'm going to close this issue as there has been no activity since last week, and it's unclear what the bug is, exactly. Please feel free to reopen it, or continue discussing below, and maybe we can find a solution together.

Good luck.