Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels