Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge targets can't be annotated tags #27

Open
vaab opened this issue Apr 10, 2019 · 3 comments
Open

merge targets can't be annotated tags #27

vaab opened this issue Apr 10, 2019 · 3 comments

Comments

@vaab
Copy link

vaab commented Apr 10, 2019

Annotated tags will crash git-aggregate when used as merge targets:
Using git version 2.7.4, and gitaggregate version 1.6.0.

mkdir /tmp/gita -p &&
cd /tmp/gita &&
cat <<EOF > repos.yaml
./foo:
    remotes:
        r1: file:///tmp/gita/r1
    target: r1 agg
    merges:
    - r1 annotated_tag
EOF

## making remote git repository 'r1', with one single commit and an annotated tag
mkdir -p r1 && cd r1
git init . &&
touch a &&
git add a &&
git commit -am "first commit" &&
git tag -am "hop" annotated_tag &&
cd ..

gitaggregate -c repos.yaml --log-level DEBUG

Would output:

(D) [16:53:48] git_aggregator.main  foo  main.aggregate_repo():198 <git_aggregator.repo.Repo object at 0x7fc528db2ba8>
(I) [16:53:48] git_aggregator.repo  foo  repo.aggregate():169 Start aggregation of /tmp/gita/foo
(I) [16:53:48] git_aggregator.repo  foo  repo.init_repository():192 Init empty git repository in /tmp/gita/foo
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ['git', 'init', '/tmp/gita/foo']
Initialized empty Git repository in /tmp/gita/foo/.git/
(I) [16:53:48] git_aggregator.repo  foo  repo._switch_to_branch():247 Switch to branch agg
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ['git', 'checkout', '-B', 'agg']
Switched to a new branch 'agg'
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ['git', 'remote', '-v']
(I) [16:53:48] git_aggregator.repo  foo  repo._set_remote():298 Adding remote r1 <file:///tmp/gita/r1>
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ['git', 'remote', 'add', 'r1', 'file:///tmp/gita/r1']
(I) [16:53:48] git_aggregator.repo  foo  repo.fetch():197 Fetching required remotes
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ('git', 'fetch', 'r1', 'annotated_tag')
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From file:///tmp/gita/r1
 * tag               annotated_tag -> FETCH_HEAD
(I) [16:53:48] git_aggregator.repo  foo  repo._merge():256 Pull r1, annotated_tag
(D) [16:53:48] git_aggregator.repo  foo  repo.log_call():158 /tmp/gita/foo> call ('git', 'pull', '--no-edit', 'r1', 'annotated_tag')
From file:///tmp/gita/r1
 * tag               annotated_tag -> FETCH_HEAD
fatal: update_ref failed for ref 'HEAD': cannot update the ref 'HEAD': Trying to write non-commit object 15f3593b4d0e7198d32e723df7d901b2f9fba96e to branch refs/heads/agg
Traceback (most recent call last):
  File "/home/vaab/lib/python/site-packages/git_aggregator/main.py", line 204, in aggregate_repo
    repo.aggregate()
  File "/home/vaab/lib/python/site-packages/git_aggregator/repo.py", line 187, in aggregate
    self._merge(merge)
  File "/home/vaab/lib/python/site-packages/git_aggregator/repo.py", line 266, in _merge
    self.log_call(cmd, cwd=self.cwd)
  File "/home/vaab/lib/python/site-packages/git_aggregator/repo.py", line 159, in log_call
    ret = callwith(cmd, **kw)
  File "/home/vaab/dev/python/pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('git', 'pull', '--no-edit', 'r1', 'annotated_tag')' returned non-zero exit status 128.

I've already solved this and will be posting a PR in a few minutes.

vaab added a commit to 0k/git-aggregator that referenced this issue Apr 10, 2019
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.
vaab added a commit to 0k/git-aggregator that referenced this issue May 23, 2020
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
vaab added a commit to 0k/git-aggregator that referenced this issue May 23, 2020
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
janverb pushed a commit to janverb/git-aggregator that referenced this issue Dec 23, 2020
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
NL66278 pushed a commit to Therp/git-aggregator that referenced this issue Feb 17, 2023
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
thomaspaulb pushed a commit to sunflowerit/git-aggregator that referenced this issue Jul 18, 2023
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
thomaspaulb added a commit to sunflowerit/git-aggregator that referenced this issue Jul 18, 2023
thomaspaulb added a commit to sunflowerit/git-aggregator that referenced this issue Jul 18, 2023
thomaspaulb added a commit to sunflowerit/git-aggregator that referenced this issue Jul 18, 2023
thomaspaulb pushed a commit to sunflowerit/git-aggregator that referenced this issue Jul 22, 2023
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
@thomaspaulb
Copy link
Contributor

I've tested, and the current version of gitaggregator (4.0) already supports annotated tags as from the issue example. So this issue can be closed.

@thomaspaulb
Copy link
Contributor

Proof: #27

thomaspaulb pushed a commit to sunflowerit/git-aggregator that referenced this issue Jul 22, 2023
…csone#28)

Avoids also contacting twice (``fetch`` and then ``pull``) remote before
merging.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
@pleirb
Copy link

pleirb commented Apr 30, 2024

I have the same problem. I am using Ubuntu 24.04 with virtual env configured for python 3
git 2.43.0
git-aggregator 2.1.0
Some time has passed, is it that in my case I should downgrade the git version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants