Fix --empty option of ifchange

This commit is contained in:
Nobuyoshi Nakada 2024-11-24 18:25:46 +09:00
parent 3826019f31
commit c6ca339955
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2024-11-24 10:07:56 +00:00
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ HELP
set -e
timestamp=
keepsuffix=
empty=
srcavail=f
color=auto
until [ $# -eq 0 ]; do
case "$1" in
@ -39,7 +39,7 @@ until [ $# -eq 0 ]; do
keepsuffix=`expr \( "$1" : '[^=]*=\(.*\)' \)`
;;
--empty)
empty=yes
srcavail=s
;;
--color)
color=always
@ -97,7 +97,7 @@ fi
targetdir=
case "$target" in */*) targetdir=`dirname "$target"`;; esac
if [ -f "$target" -a ! -${empty:+f}${empty:-s} "$temp" ] || cmp "$target" "$temp" >/dev/null 2>&1; then
if [ -f "$target" -a ! -${srcavail} "$temp" ] || cmp "$target" "$temp" >/dev/null 2>&1; then
echo "$target ${msg_unchanged}unchanged${msg_reset}"
rm -f "$temp"
else

View File

@ -62,7 +62,7 @@ set src=%src:/=\%
if exist %dest% (
if not exist %src% goto :nt_unchanged1
if "%empty%" == "" for %%I in (%src%) do if %%~zI == 0 goto :nt_unchanged
if not "%empty%" == "" for %%I in (%src%) do if %%~zI == 0 goto :nt_unchanged
fc.exe %dest% %src% > nul && (
:nt_unchanged
del %src%