This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e5708cc Don't show empty changes
8e5708cc is described below

commit 8e5708cca46c887616c2deb08ddb2cab3f8555d5
Author: Sebb <s...@apache.org>
AuthorDate: Tue Apr 23 11:19:03 2024 +0100

    Don't show empty changes
---
 lib/whimsy/asf/json-utils.rb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/json-utils.rb b/lib/whimsy/asf/json-utils.rb
index 4afe29ae..56d9285b 100644
--- a/lib/whimsy/asf/json-utils.rb
+++ b/lib/whimsy/asf/json-utils.rb
@@ -47,7 +47,15 @@ module ASFJSON
         out.puts [bcj, key, v1, '=>', v2].inspect
       when 'Array'
         v1, v2 = args
-        out.puts  [bcj, key, 'Dropped', v1-v2, 'Added', v2-v1].inspect
+        dropped = v1 - v2
+        added = v2 - v1
+        if dropped.size == 0
+          out.puts  [bcj, key, 'Added', v2-v1].inspect
+        elsif added.size == 0
+          out.puts  [bcj, key, 'Dropped', v1-v2].inspect
+        else
+          out.puts  [bcj, key, 'Dropped', v1-v2, 'Added', v2-v1].inspect
+        end
       when 'Dropped'
         out.puts  [bcj, 'Dropped', key, args].inspect
       when 'Added'

Reply via email to