Skip to content

Commit

Permalink
Merge pull request #43 from pH5/topicless-tag
Browse files Browse the repository at this point in the history
umpf: Fix topicless tag creation
  • Loading branch information
michaelolbrich authored Jul 12, 2024
2 parents aab68bc + fc05845 commit 09bc9e6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tests = [
'umpf-series-tag-continue',
'umpf-series-tag-rerere',
'umpf-series-tag-continue-flags',
'umpf-series-tag-empty',
'umpf-format-patch',
'umpf-format-patch-bb',
'umpf-show',
Expand Down
4 changes: 4 additions & 0 deletions tests/series-empty-v2.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# umpf-base: base
# umpf-name: name
# umpf-version: name/20221209-2
# umpf-end
9 changes: 9 additions & 0 deletions tests/umpf-series-tag-empty
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
#
# Test creating an umpf tag from a series file without any topics.
#

umpf tag --version=2 --base=base --name=name --remote=origin

git log --format=%B -n 1 | grep "^# umpf-" > series.tag
diff -u ${TEST_DIR}/series-empty-v2.ref series.tag
10 changes: 7 additions & 3 deletions umpf
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ Upstream-Status: Inappropriate [autogenerated]"
create_tag() {
local args tagname parents tree topic
local -a topics
if [ ! -e "${STATE}/tag" ]; then
return
Expand All @@ -1294,9 +1295,12 @@ create_tag() {
fi
tree="$(${GIT} log -1 --format="%T")"
for topic in $(<"${STATE}/topics"); do
parents="${parents} -p ${topic}"
done
if [ -e "${STATE}/topics" ]; then
mapfile -t topics < "${STATE}/topics"
for topic in "${topics[@]}"; do
parents="${parents} -p ${topic}"
done
fi
commit=$(${GIT} commit-tree "${tree}" -p HEAD ${parents} -m "${tagname}" -F "${STATE}/series.next")
if ${GIT} tag ${args} --cleanup=verbatim -F "${STATE}/series.next" "${tagname}" "${commit}" >&2; then
Expand Down

0 comments on commit 09bc9e6

Please sign in to comment.