fetch: make --prune-tags clobber changed tags
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest2 patches 0 repliesNew
Changes in v2 from the cover letter
* Instead of treating --prune-tags like --force for tags, add "+" to the refspec that --prune-tags implies. v1 also forced tags fetched with an explicit refspec when fetch.pruneTags was set, even though tags are not pruned in that case.
* The commit message now says what fetch does today, and where this broke.
* The tests check that the local tag was actually updated, not only that fetch succeeded, and that "git fetch origin tag <name>" is still refused with fetch.pruneTags set.
* Rebased on current master.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | fetch: test that --force clobbers a changed tagt/ | +12 | 0 replies | |
| 2/2 | fetch: make --prune-tags clobber changed tagsDocumentation/ Documentation/ builtin/ +1 more | +26 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] fetch: make --prune-tags clobber changed tags
--prune-tags is documented to force-update tags that changed on the remote, but since 0bc8d71b99 (Git 2.20) it rejects them with "would clobber existing tag".
Changes since v1:
* Instead of treating --prune-tags like --force for tags, add "+" to the refspec that --prune-tags implies. v1 also forced tags fetched with an explicit refspec when fetch.pruneTags was set, even though tags are not pruned in that case.
* The commit message now says what fetch does today, and where this broke.
* The tests check that the local tag was actually updated, not only that fetch succeeded, and that "git fetch origin tag <name>" is still refused with fetch.pruneTags set.
* Rebased on current master.
Orgad Shaneh (2):
fetch: test that --force clobbers a changed tag
fetch: make --prune-tags clobber changed tags
Documentation/config/fetch.adoc | 2 +- Documentation/git-fetch.adoc | 2 +- builtin/fetch.c | 4 ++-- t/t5516-fetch-push.sh | 35 ++++++++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 5 deletions(-)
Range-diff against v1:
1: 3a5b1c73a6 ! 1: 6ee374acd4 fetch: add a test for --force flag
@@ Metadata
Author: Orgad Shaneh <[email protected]>
## Commit message ##
- fetch: add a test for --force flag
+ fetch: test that --force clobbers a changed tag
- There are two ways to force-fetch tags that have changed: either by
- specifying an explicit forced ref (+refs/tags/*:refs/tags/*), or by
- using --force.
+ Changed tags can be force-fetched with a "+" refspec or with --force,
+ but only the refspec was tested. The test also didn't check that the
+ tag was actually updated, only that fetch succeeded.
- The first approach was already tested, but the second was not. This
- has now been addressed.
+ Add the --force case, and check the tag after each forced fetch.
- Signed-off-by: Orgad Shaneh <[email protected]>
+ Signed-off-by: Orgad Shaneh <[email protected]>
## t/t5516-fetch-push.sh ##
+@@ t/t5516-fetch-push.sh: test_force_push_tag () {
+ test_force_push_tag "lightweight tag" "-f"
+ test_force_push_tag "annotated tag" "-f -a -m'tag message'"
+
++check_child1_tag () {
++ git rev-parse testTag >expect &&
++ git -C ../child1 rev-parse testTag >actual &&
++ test_cmp expect actual
++}
++
+ test_force_fetch_tag () {
+ tag_type_description=$1
+ tag_args=$2
@@ t/t5516-fetch-push.sh: test_force_fetch_tag () {
git commit -m 'file1' &&
git tag $tag_args testTag &&
test_must_fail git -C ../child1 fetch origin tag testTag &&
- git -C ../child1 fetch origin '+refs/tags/*:refs/tags/*'
+ git -C ../child1 fetch origin '+refs/tags/*:refs/tags/*' &&
++ check_child1_tag &&
+ git tag $tag_args testTag HEAD^ &&
+ test_must_fail git -C ../child1 fetch origin tag testTag &&
-+ git -C ../child1 fetch --force origin tag testTag
++ git -C ../child1 fetch --force origin tag testTag &&
++ check_child1_tag
)
"
}
2: ae82d31bfb < -: ---------- fetch: clobber existing tags with --prune-tags
-: ---------- > 2: 3ed44788d7 fetch: make --prune-tags clobber changed tagsbase-commit: f7de81456940dd6f3274e461149bba12965de609
Signature · 1 line
2.53.0