From 8c7cd49a0744af2063cac38eee3fdb9ba833249b Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 17 Mar 2019 18:09:33 -0400 Subject: ob-applypatches: Reduce cd calls --- diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh index 3339a48..999b0cd 100644 --- a/src/ob-applypatches.sh +++ b/src/ob-applypatches.sh @@ -28,6 +28,7 @@ apply_patches() applied='false' if [ -d '../patches' ] && [ -d 'src' ]; then + cd 'src/' # Iterate over patches ordered alphabetically by name. # POSIX.1-2008 says that the results of a pathname expansion # shall be "sorted according to the collating sequence in effect @@ -35,21 +36,20 @@ apply_patches() # set a standard locale. orig_lang="${LANG}" LANG='POSIX' - for patch in '../patches/'*; do + for patch in '../../patches/'*; do [ -f "${patch}" ] || continue LANG="${orig_lang}" - patch="${patch#../patches/}" + patch="${patch#../../patches/}" ob_info "$(ob_get_msg 'applying_patch')" "${patch}" - cd src if ! patch -N -p 1 -u -i "../../patches/${patch}"; then ob_error "$(ob_get_msg 'cant_apply_patch')" \ "${patch}" return 1 fi - cd .. applied='true' done LANG="${orig_lang}" + cd '../' fi ${applied} || ob_info "$(ob_get_msg 'no_patches')" -- cgit v0.9.1