fix: replace corrupted bytes and respect remote default branch
Replace broken control characters and U+FFFD replacement characters in log function labels with ASCII equivalents ([ok], [!], [x]). Drop the hardcoded "main" default for git_ref so arty deps no longer fails with "pathspec 'main' did not match" on repos whose default branch is not named main — git clone already checks out the remote default branch. A ref: value in arty.yml is still honoured when explicitly set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-14
@@ -47,15 +47,15 @@ log_info() {
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "${GREEN}[]${NC} $1" >&2
|
||||
echo -e "${GREEN}[ok]${NC} $1" >&2
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[�]${NC} $1" >&2
|
||||
echo -e "${YELLOW}[!]${NC} $1" >&2
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[]${NC} $1" >&2
|
||||
echo -e "${RED}[x]${NC} $1" >&2
|
||||
}
|
||||
|
||||
log_debug() {
|
||||
@@ -65,7 +65,7 @@ log_debug() {
|
||||
}
|
||||
|
||||
log_step() {
|
||||
echo -e "${CYAN}[�]${NC} $1" >&2
|
||||
echo -e "${CYAN}[!]${NC} $1" >&2
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
@@ -403,7 +403,7 @@ is_installed() {
|
||||
install_lib() {
|
||||
local repo_url="$1"
|
||||
local lib_name="${2:-$(get_lib_name "$repo_url")}"
|
||||
local git_ref="${3:-main}"
|
||||
local git_ref="${3:-}"
|
||||
local custom_into="${4:-}"
|
||||
local config_file="${5:-$ARTY_CONFIG_FILE}"
|
||||
|
||||
@@ -453,9 +453,15 @@ install_lib() {
|
||||
fi
|
||||
|
||||
# Try to update
|
||||
if [[ -n "$git_ref" ]]; then
|
||||
(cd "$lib_dir" && git fetch -q && git checkout -q "$git_ref" && git pull -q) || {
|
||||
log_warn "Failed to update library (continuing with existing version)"
|
||||
}
|
||||
else
|
||||
(cd "$lib_dir" && git fetch -q && git pull -q) || {
|
||||
log_warn "Failed to update library (continuing with existing version)"
|
||||
}
|
||||
fi
|
||||
|
||||
return 0
|
||||
fi
|
||||
@@ -469,11 +475,11 @@ install_lib() {
|
||||
|
||||
log_info "Installing library: $lib_name"
|
||||
log_info "Repository: $repo_url"
|
||||
log_info "Git ref: $git_ref"
|
||||
log_info "Git ref: ${git_ref:-<default>}"
|
||||
log_info "Location: $lib_dir"
|
||||
|
||||
if [[ "$ARTY_DRY_RUN" == "1" ]]; then
|
||||
log_info "[DRY RUN] Would clone repository and checkout $git_ref"
|
||||
log_info "[DRY RUN] Would clone repository${git_ref:+ and checkout $git_ref}"
|
||||
unmark_installing "$lib_id_with_path"
|
||||
return 0
|
||||
fi
|
||||
@@ -485,10 +491,12 @@ install_lib() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Checkout the specified ref
|
||||
# Checkout the specified ref (skip if none given; clone already checked out the default branch)
|
||||
if [[ -n "$git_ref" ]]; then
|
||||
(cd "$lib_dir" && git checkout -q "$git_ref") || {
|
||||
log_warn "Failed to checkout ref '$git_ref', using default branch"
|
||||
}
|
||||
fi
|
||||
|
||||
# Run setup hook if exists
|
||||
if [[ -f "$lib_dir/setup.sh" ]]; then
|
||||
@@ -626,9 +634,6 @@ install_references() {
|
||||
continue
|
||||
fi
|
||||
|
||||
# Use default ref if not specified
|
||||
[[ -z "$git_ref" ]] && git_ref="main"
|
||||
|
||||
# Get library name
|
||||
local lib_name=$(get_lib_name "$url")
|
||||
|
||||
@@ -775,12 +780,12 @@ build_reference_tree() {
|
||||
|
||||
# Add dirty indicator
|
||||
if [[ "$is_dirty" == "1" ]]; then
|
||||
printf " ${YELLOW}${NC}"
|
||||
printf " ${YELLOW}*${NC}"
|
||||
fi
|
||||
|
||||
# Add location info
|
||||
if [[ -n "$into" ]]; then
|
||||
printf " ${MAGENTA}� %s${NC}" "$into"
|
||||
printf " ${MAGENTA}-> %s${NC}" "$into"
|
||||
fi
|
||||
|
||||
echo
|
||||
@@ -1748,7 +1753,7 @@ PROJECT DISCOVERY:
|
||||
| ||||