Skip to content

Commit

Permalink
snapshot: Report match in --diff if there are no changes
Browse files Browse the repository at this point in the history
The user experience of 'sudo port snapshot --diff $id --all' just
printing nothing is not great. Improve this by explicitly printing
a success message if there are no changes.

(cherry picked from commit 35e8fc4)
  • Loading branch information
neverpanic authored and jmroot committed Jul 25, 2024
1 parent 7d7551d commit 1dcbcf5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/macports1.0/snapshot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ namespace eval snapshot {
}
}
}

if {[llength $diff(removed)] > 0} {
append note "The following ports are in the snapshot but not installed:\n"
foreach removed_port [lsort -ascii -index 0 $diff(removed)] {
Expand Down Expand Up @@ -169,6 +170,10 @@ namespace eval snapshot {
}
}

if {[llength $diff(added)] == 0 && [llength $diff(removed)] == 0 && [llength $diff(changed)] == 0} {
append note "The current state and the specified snapshot match.\n"
}

ui_msg [string trimright $note "\n"]
return 0
}
Expand Down

0 comments on commit 1dcbcf5

Please sign in to comment.