1. 증분 백업 버그 수정

2. 일반 백업 해쉬 비교 추가
This commit is contained in:
LHK
2025-08-01 14:54:47 +09:00
부모 5a0ca30cf7
커밋 bfe006338a

파일 보기

@@ -199,7 +199,7 @@ func RunBackup(ctx context.Context, src, dst string, opts Options) error {
dstInfo, err := os.Stat(dstPath)
fileExists := err == nil
if fileExists && !opts.Force {
if !opts.Force {
if opts.Incremental {
// 증분 백업 모드에서는 메타데이터를 확인
srcInfo, err := os.Stat(srcPath)
@@ -230,6 +230,7 @@ func RunBackup(ctx context.Context, src, dst string, opts Options) error {
meta.Files[relPath] = newValue
} else {
if fileExists {
// 일반 모드에서는 크기와 수정 시간만 비교
srcInfo, err := os.Stat(srcPath)
if err != nil {
@@ -258,12 +259,12 @@ func RunBackup(ctx context.Context, src, dst string, opts Options) error {
}
}
}
}
// 파일 복사
if err := copyFile(srcPath, dstPath); err != nil {
return fmt.Errorf("파일을 복사할 수 없습니다: %w", err)
}
opts.Logger.Printf("복사됨: %s\n", relPath)
}