Skip to content

Commit 09c1366

Browse files
committed
Tell when local files differ from boilerplate
1 parent 2f8e039 commit 09c1366

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

commands/init

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@ create-parent-dir() {
7676

7777
add-file() {
7878
local FILE="$1"
79-
if [ ! -e "$FILE" ]; then
80-
create-parent-dir "$FILE"
81-
cat > "$FILE"
82-
git add "$FILE"
79+
if [ -e "$FILE" ]; then
80+
if ! diff -q "$FILE" - > /dev/null; then
81+
echo "NOTE: $FILE differs from boilerplate."
82+
fi
83+
return 0
8384
fi
85+
create-parent-dir "$FILE"
86+
cat > "$FILE"
87+
git add "$FILE"
8488
}
8589

8690
add-file .clang-format << EOF

0 commit comments

Comments
 (0)