-
Notifications
You must be signed in to change notification settings - Fork 1
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
FP-1544: Annotate Lightweight Tags #465
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
822da84
FP-1544: Annotate Lightweight Tags
wesleyboar aa93787
FP-1544: Fix Gitignore Addition
wesleyboar 3667bc9
FP-1544: Fix Tag Summary/Status Output
wesleyboar 36e702c
Quick: Link to alternatives for the script
wesleyboar d0dc3ef
Quick: Reduce verbosity of comment from 36e702c
wesleyboar 2781f2c
Merge branch 'main' into task/FP-1544-annotate-lightweight-tags
wesleyboar 5cdc439
Merge branch 'main' into task/FP-1544-annotate-lightweight-tags
wesleyboar f283d0f
Merge branch 'task/FP-1544-annotate-lightweight-tags' of github.com:T…
wesleyboar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
*.pyo | ||
__pycache__ | ||
|
||
# Shell | ||
_git_annotate_existing_tags | ||
|
||
# Project | ||
/public/static | ||
/public/media | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh | ||
|
||
# Bug: (2022-03-12) (for a commit after v3.15.0) | ||
# Running `git describe` gave unexpected output. | ||
# - expect: "v3.15.0-…-g…" | ||
# - actual: "v3.7.0-…-g…" | ||
# Why: 1. Most tags after (and before) v3.7.0 were not annotated. Similar: | ||
# https://github.com/Reference-LAPACK/lapack/issues/123 | ||
# 2. Because GitHub uses lightweight tags. Feedback for GitHub: | ||
# https://github.com/github/feedback/discussions/4924 | ||
# Fix: Run this script to retroactively annotate lightweight tags. | ||
# (Note, this script also re-annotates annotated tags.) | ||
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Alt: See answers to https://stackoverflow.com/q/21738647/11817077 | ||
# (More elegant but may not preserve all of tag message with new lines.) | ||
|
||
# make output directory | ||
OUTPUT_DIR='_git_annotate_existing_tags' | ||
mkdir -p "$OUTPUT_DIR" | ||
|
||
# define how to save current status of tag annotation | ||
function save_tag_summary() { | ||
local path=$1 | ||
|
||
echo "$(git tag --format='%(creatordate)%09%(refname:strip=2) %(taggerdate) %(contents)')" > $path | ||
} | ||
|
||
# define how to annotate tags (will also re-annotate tags) | ||
function annotate() { | ||
local tag=$1 | ||
|
||
# get data for tag (some is new for annotation, some must be preserved) | ||
local date="$(echo $(git tag --format='%(creatordate)' --list $tag))" | ||
local msg="$(git tag --format='%(contents)' --list $tag)" | ||
local hash="$(git rev-list -n 1 $tag)" | ||
|
||
# save message to file to preserve new lines | ||
local msg_file_path="$OUTPUT_DIR/message.temp" | ||
echo "$msg" > $msg_file_path | ||
|
||
# tell the user what we will do | ||
echo "Annotate tag $(printf "%9s" $tag) (commit ${hash:0:7}) with date \"$date\" and retain its message \"${msg:0:30}...\"." | ||
|
||
# annotate | ||
GIT_COMMITTER_DATE=$date \ | ||
git tag --annotate --force --file "$msg_file_path" "$tag" "$hash" | ||
|
||
# clean up | ||
rm $msg_file_path | ||
} | ||
|
||
# save current status to file for comparison | ||
save_tag_summary "$OUTPUT_DIR/summary_before.temp" | ||
|
||
# annotate each tag passed | ||
for tag in "$@"; do annotate "$tag"; done | ||
|
||
# save new status to file for comparison | ||
save_tag_summary "$OUTPUT_DIR/summary_after.temp" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script was eventually restored. It's available in
main
currently. Permalink for the v4.9.0 one.