forked from Shinonome/dots-hyprland
Test
This commit is contained in:
@@ -157,7 +157,11 @@ VERBOSE=false
|
||||
NON_INTERACTIVE=true
|
||||
|
||||
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
||||
detect_repo_structure
|
||||
detected_dirs=$(detect_repo_structure)
|
||||
if [[ -n "$detected_dirs" ]]; then
|
||||
read -ra MONITOR_DIRS <<<"$detected_dirs"
|
||||
fi
|
||||
echo "Structure: ${MONITOR_DIRS[*]}"
|
||||
EOF
|
||||
|
||||
chmod +x test_detection.sh
|
||||
@@ -212,7 +216,11 @@ VERBOSE=false
|
||||
NON_INTERACTIVE=true
|
||||
|
||||
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
||||
detect_repo_structure
|
||||
detected_dirs=$(detect_repo_structure)
|
||||
if [[ -n "$detected_dirs" ]]; then
|
||||
read -ra MONITOR_DIRS <<<"$detected_dirs"
|
||||
fi
|
||||
echo "Structure: ${MONITOR_DIRS[*]}"
|
||||
EOF
|
||||
|
||||
chmod +x test_detection.sh
|
||||
@@ -507,7 +515,7 @@ test_lock_file() {
|
||||
echo "99999" > .update-lock
|
||||
|
||||
# Try to run update - should fail due to lock
|
||||
if ./install.sh exp-update --skip-notice --non-interactive --dry-run 2>&1 | grep -q "stale lock"; then
|
||||
if ./install.sh exp-update --skip-notice --non-interactive 2>&1 | grep -q "stale lock"; then
|
||||
log_pass "Lock file mechanism works (detected stale lock)"
|
||||
cd "$ORIGINAL_DIR"
|
||||
return 0
|
||||
@@ -780,7 +788,6 @@ main() {
|
||||
"test_flags"
|
||||
"test_shellcheck"
|
||||
"test_lock_file"
|
||||
"test_ignore_pattern_caching"
|
||||
"test_directory_caching"
|
||||
"test_safe_read_noninteractive"
|
||||
)
|
||||
|
||||
@@ -49,9 +49,6 @@ declare -A CREATED_DIRS
|
||||
# TODO: Is this really needed? `git pull` should do a full upgrade, not partially, which means this script will be updated along with the folder structure together.
|
||||
# Auto-detect repository structure
|
||||
detect_repo_structure() {
|
||||
if which pacman &>/dev/null; then
|
||||
return
|
||||
fi
|
||||
local found_dirs=()
|
||||
|
||||
# Check for dots/ prefixed structure
|
||||
@@ -164,7 +161,9 @@ load_ignore_patterns() {
|
||||
|
||||
# Separate substring patterns from regular patterns
|
||||
if [[ "$pattern" == \*\** ]]; then
|
||||
IGNORE_SUBSTRING_PATTERNS+=("${pattern#\*\*}")
|
||||
local cleaned_pattern="${pattern#\*\*}"
|
||||
cleaned_pattern="${cleaned_pattern%%*}"
|
||||
IGNORE_SUBSTRING_PATTERNS+=("$cleaned_pattern")
|
||||
else
|
||||
IGNORE_PATTERNS+=("$pattern")
|
||||
fi
|
||||
@@ -720,7 +719,7 @@ cleanup_on_exit() {
|
||||
trap cleanup_on_exit EXIT INT TERM
|
||||
|
||||
# Check for concurrent runs
|
||||
if [[ -f "${REPO_ROOT}/.update-lock" ]] && [[ "$DRY_RUN" != true ]]; then
|
||||
if [[ -f "${REPO_ROOT}/.update-lock" ]]; then
|
||||
# Check if the process is still running
|
||||
if kill -0 $(cat "${REPO_ROOT}/.update-lock" 2>/dev/null) 2>/dev/null; then
|
||||
log_die "Another update is already running (PID: $(cat "${REPO_ROOT}/.update-lock"))"
|
||||
@@ -963,8 +962,8 @@ elif has_new_commits; then
|
||||
process_files=true
|
||||
log_info "New commits detected: checking changed configuration files"
|
||||
else
|
||||
log_info "No new commits found: checking for local file differences"
|
||||
process_files=true
|
||||
log_info "No new commits found and force mode not enabled: skipping file updates"
|
||||
process_files=false
|
||||
fi
|
||||
|
||||
if [[ "$process_files" == true ]]; then
|
||||
|
||||
Reference in New Issue
Block a user