]> source.dussan.org Git - jgit.git/commit
Walk tag chains for --include-tag options 08/119408/5
authorPavel Flaška <Pavel.Flaska@gmail.com>
Fri, 24 Nov 2017 13:55:28 +0000 (14:55 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 16 Jun 2019 00:17:20 +0000 (02:17 +0200)
commite456fba8ac16a08da12e21d59b6eab3759c9c16b
treea8c809d48b790c65b30f12b61da748b07d20e36a
parentfe676e7084a1bc770cafc0c96955503801f80e7d
Walk tag chains for --include-tag options

When cloning repository with --single-branch option, tag chains are not
packed and pack file is broken in some cases.

Typical test-case:
git tag -a test_tag <commit-id>
git tag -a test_prev_tag test_tag
git tag -d test_tag

git clone --single-branch <repository>
fatal: did not receive expected object <test_tag_id>

The reason for that is missing object for original test_tag reference,
which was deleted.

Problem description:
When pack-objects is given --include-tag, it peels each tag reference
down to a commit. If the commit is prepared to be packed, we we have to
include such tag too. The problem is when the tag points to through some
chain of other tag to commit. Then, the inner tags are not added leading
to broken pack.

Fix:
When going to commit, we have to check and add any of the tags on the
way (if they were not selected, which may happen with --single-branch
option).

Change-Id: I1682d4a2c52d674f90a1b021e0f6c3524c5ce5bc
Signed-off-by: Pavel Flaška <Pavel.Flaska@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java