scripts: fix diff sending
authorJulien Moutinho (adh14) <julm+rezine@autogeree.net>
Mon, 15 Jan 2024 01:26:59 +0000 (02:26 +0100)
committerJulien Moutinho (adh14) <julm+rezine@autogeree.net>
Mon, 15 Jan 2024 01:35:53 +0000 (02:35 +0100)
scripts/lib.sh
scripts/send.sh

index a618b58e9dc9fb98b1894673eb83efaa99949c26..aad40a3b3d96e1cd18ec4748b825037721d8d0cc 100644 (file)
@@ -224,11 +224,4 @@ rfcTag () {
     git commit -m "$rfcBranch: v$rfcRevAdvocacy c$rfcRevCriticisms"
     git tag --force --sign --message "${rfcOrga} RFC${rfcTag}" "$rfcTag"
   fi
-
-  git_push_remote=${git_push_remote-origin}
-  if test ! "${no_git_push:+set}"; then
-    git push ${git_push-} --follow-tags "$git_push_remote" "$rfcTag"
-    git push ${git_push-} "$git_push_remote" "$(git rev-list "$rfcTag" -1):${rfcBranch}"
-    git push ${git_push-} "$git_push_remote"
-  fi
 }
index f2600392675352248bc02493b23ef1082d928481..b4d9a6957764ea228b74b53f0bd6c3cd91dd9860 100755 (executable)
@@ -11,12 +11,11 @@ rfcDir=$1; shift
 test $# -le 0 || declare "$@"
 
 exitTrap () {
-  rm -f "$coverLetter"
-  rm -fr "$patchesDir"
+  rm -f "${coverLetter-}" "${rfcAdvocacyMeta-}"
+  rm -fr "${patchesDir-}"
 }
 trap exitTrap EXIT
 coverLetter=$(mktemp)
-patchesDir=$(mktemp -d)
 mimepart_mixed=$(uuidgen)
 mimepart_alternative=$(uuidgen)
 mimepart_related=$(uuidgen)
@@ -26,6 +25,9 @@ rfcRevision
 rfcTag
 #rfcPDF -o "$rfcDir/${rfcRepo}-${rfcTag}".pdf
 
+git_push_remote=${git_push_remote-origin}
+
+if test ! "${no_git_send_email:+set}"; then
 { # coverLetter
 
 rfcPlain \
@@ -95,16 +97,26 @@ EOF
 
 } >"$coverLetter"
 
-git format-patch "$rfcTagAdvocacyOld..$rfcTag^" \
+patchesDir=$(mktemp -d)
+git format-patch "${git_push_remote}/${rfcBranch}..$rfcTag" \
   --output-directory "$patchesDir" \
-  "$rfcDir"
+  "$rfcDir" ':!*.html'
 
+rfcAdvocacyMeta=$(mktemp --suffix ".json")
+pandoc -o "$rfcAdvocacyMeta" --to plain \
+   --template "$rfcRoot"/styles/metadata.json \
+  "$rfcDir"/advocacy.md
 git send-email ${git_send_email-} \
-  --to "$(pandoc --to plain --template "$rfcRoot"/styles/metadata.json "$rfcDir"/advocacy.md | jq -r .To | sed -e '/^null$/d')" \
-  --cc "$(pandoc --to plain --template "$rfcRoot"/styles/metadata.json "$rfcDir"/advocacy.md | jq -r .Cc | sed -e '/^null$/d')" \
+  --to "$(jq -r .To <"$rfcAdvocacyMeta" | sed -e '/^null$/d')" \
+  --cc "$(jq -r .Cc <"$rfcAdvocacyMeta" | sed -e '/^null$/d')" \
   --confirm cc \
   --8bit-encoding UTF-8 \
   --cover-letter "$coverLetter" \
   "$patchesDir"
+fi
 
-cleanTag () { :; }
+if test ! "${no_git_push:+set}"; then
+  git push ${git_push-} --follow-tags "$git_push_remote" "$rfcTag"
+  git push ${git_push-} "$git_push_remote" "$(git rev-list "$rfcTag" -1):${rfcBranch}"
+  git push ${git_push-} "$git_push_remote"
+fi