public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/firefox] rawhide: updated firefox-update.sh
@ 2026-09-23  8:05 Martin Stransky
  0 siblings, 0 replies; only message in thread
From: Martin Stransky @ 2026-09-23  8:05 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/firefox
Branch : rawhide
Commit : 1b9a6ee198e34123c04f9d3a91a32067ac3fde9b
Author : Martin Stransky <stransky@redhat.com>
Date   : 2026-09-23T10:04:57+02:00
Stats  : +41/-0 in 1 file(s)
URL    : https://src.fedoraproject.org/rpms/firefox/c/1b9a6ee198e34123c04f9d3a91a32067ac3fde9b?branch=rawhide

Log:
updated firefox-update.sh

---
diff --git a/firefox-update.sh b/firefox-update.sh
index de1c437..b72b1a0 100755
--- a/firefox-update.sh
+++ b/firefox-update.sh
@@ -344,6 +344,44 @@ show_local_changes() {
     return 0
 }
 
+# Prints the diff that is about to be committed. Rebased patch files can make
+# it huge, so anything longer than $DIFF_PREVIEW_LINES is only shown on request.
+DIFF_PREVIEW_LINES=500
+
+show_staged_diff() {
+    if git diff --cached --quiet; then
+        warn "Nothing is staged - there is no diff to review."
+        return 1
+    fi
+
+    printf '\n%sDiff to be committed:%s\n\n' "$C_BOLD$C_YELLOW" "$C_OFF"
+    git --no-pager diff --cached --stat
+
+    local lines
+    lines=$(git --no-pager diff --cached | wc -l)
+    printf '\n'
+    if [ "$lines" -le "$DIFF_PREVIEW_LINES" ]; then
+        git --no-pager diff --cached
+    else
+        info "The diff has $lines lines."
+        if confirm "Show the full diff?"; then
+            git --no-pager diff --cached
+        else
+            info "Skipped; review it later with 'git diff --cached'."
+        fi
+    fi
+
+    # Changes left out of the commit are easy to miss once fedpkg opens $EDITOR.
+    if ! git diff --quiet; then
+        printf '\n'
+        warn "These tracked files are modified but NOT staged:"
+        git --no-pager diff --name-only | sed 's/^/     /' >&2
+    fi
+
+    printf '\n'
+    return 0
+}
+
 # Destructive prompts are never auto-answered by --yes; they always need a
 # deliberate keystroke. Answering 'q' aborts the whole update.
 confirm_destructive() {
@@ -863,6 +901,9 @@ if ! skip_step 13; then
     printf '\n%sStaged changes:%s\n' "$C_BOLD" "$C_OFF"
     git status --short --untracked-files=no
 
+    show_staged_diff
+    confirm "Commit these changes?" y || die "Commit cancelled - the changes stay staged"
+
     run fedpkg commit -c || die "fedpkg commit failed"
     ok "Committed: $(git log -1 --pretty=%s)"
 fi

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-23  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23  8:05 [rpms/firefox] rawhide: updated firefox-update.sh Martin Stransky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox