Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
58daca8
ci: print file paths whily performing yaml diff
j-zimnowoda Mar 27, 2026
6784163
ci: print file paths whily performing yaml diff
j-zimnowoda Mar 27, 2026
a6655b7
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 30, 2026
8789a5a
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 30, 2026
ca60380
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 30, 2026
92d2ff2
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 30, 2026
2efbfe1
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 30, 2026
bab23b4
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 31, 2026
beef12c
Merge branch 'main' into diff-with-paths
svcAPLBot Mar 31, 2026
cf2f806
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 1, 2026
7bc960b
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 1, 2026
60cb77b
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 1, 2026
0aaea13
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 1, 2026
d225d25
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 1, 2026
20f5ee0
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 2, 2026
c7d6eb9
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 7, 2026
55c4e76
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 8, 2026
c6c393c
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 8, 2026
2bcc88c
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 8, 2026
ce13274
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 8, 2026
d13bf9d
Merge branch 'main' into diff-with-paths
svcAPLBot Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 58 additions & 10 deletions bin/dyff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,72 @@ elif [ -z "$targetDirB" ]; then
exit 1
fi

targetDirA=${targetDirA%/}
targetDirB=${targetDirB%/}

to_relative_path() {
local full_path=$1
local base_path=$2
local rel

if [[ "$full_path" == "$base_path" ]]; then
printf '%s' "."
return
elif [[ "$full_path" == "$base_path/"* ]]; then
rel="${full_path#"$base_path/"}"
else
rel="$full_path"
fi

# Strip the first directory component
printf '%s' "${rel#*/}"
}

join_relative_path() {
local dir_path=$1
local file_name=$2

if [[ "$dir_path" == "." ]]; then
printf '%s' "$file_name"
else
printf '%s' "$dir_path/$file_name"
fi
}

print_comment() {
echo "# $*"
}

set +e
diff_output=$(diff -q -r "$targetDirA" "$targetDirB")
set -e
# Process each line of diff output

# Process each line of diff output.
echo "$diff_output" | while read -r line; do
# Check if the line indicates a difference
if [[ $line == *" and "* ]]; then
# Extract the paths using cut
first_path=$(echo $line | cut -d' ' -f2)
second_path=$(echo $line | cut -d' ' -f4)
# diff -q -r emits: "Files <pathA> and <pathB> differ"
if [[ $line =~ ^Files[[:space:]]+(.+)[[:space:]]+and[[:space:]]+(.+)[[:space:]]+differ$ ]]; then
# Capture regex groups from the above regex pattern to get the full paths of the differing files
first_path="${BASH_REMATCH[1]}"
second_path="${BASH_REMATCH[2]}"
relative_first_path=$(to_relative_path "$first_path" "$targetDirA")
relative_second_path=$(to_relative_path "$second_path" "$targetDirB")

[ ! -f "$second_path" ] && print_comment "New file added: $relative_first_path" && continue
[ ! -f "$first_path" ] && print_comment "Old file deleted: $relative_second_path" && continue

[ ! -f $second_path ] && echo "New file added: $first_path" && continue
[ ! -f $first_path ] && echo "Old file deleted: $second_path" && continue
print_comment "$relative_first_path"

# Use dyff to compare the files
dyff between "$second_path" "$first_path" --omit-header \
--exclude "data.tls.key" --exclude "/data/ca.crt" --exclude "/data/tls.crt" --exclude "/data/tls.key" \
--exclude-regexp "/checksum" --exclude-regexp "/webhooks.*" --ignore-order-changes "${miscArgs[@]}"
elif [[ $line =~ ^Only[[:space:]]+in[[:space:]]+(.+):[[:space:]]+(.+)$ ]]; then
only_in_dir="${BASH_REMATCH[1]}"
only_in_file="${BASH_REMATCH[2]}"
if [[ "$only_in_dir" == "$targetDirA"* ]]; then
print_comment "New file added: $(join_relative_path "$(to_relative_path "$only_in_dir" "$targetDirA")" "$only_in_file")"
elif [[ "$only_in_dir" == "$targetDirB"* ]]; then
print_comment "Old file deleted: $(join_relative_path "$(to_relative_path "$only_in_dir" "$targetDirB")" "$only_in_file")"
else
print_comment "$line"
fi
fi
done
37 changes: 32 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading