Skip to Content.
Sympa Menu

sm-commit - Re: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (ebb3d4ea0344f74a552a75a2b3f4df78275aa44c)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Thomas Orgis <thomas-forum AT orgis.org>
  • To: sm-commit AT lists.ibiblio.org
  • Cc: Ismael Luceno <ismael AT sourcemage.org>
  • Subject: Re: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (ebb3d4ea0344f74a552a75a2b3f4df78275aa44c)
  • Date: Mon, 15 Aug 2016 08:48:45 +0200

Am Sun, 14 Aug 2016 02:52:53 +0000
schrieb Ismael Luceno <scm AT sourcemage.org>:

> #---------------------------------------------------------------------
> +## Apply patches from a directory
> +#---------------------------------------------------------------------
> +function apply_patch_dir() {
> + [ -d "$SPELL_DIRECTORY/$1" ] || return 0
> + find "$SPELL_DIRECTORY/$1" \( -name \*.patch -o -name \*.diff \) -print0
> |
> + sort -zV | xargs -0 -n 1 -t patch -fp1 -i
> +}

Several questions come to mind:

1. Why does `apply_patch_dir nonexisting_dir` not return an error?
2. Why does it always use -fp1?
- I never use -f … it still fails if the patch doesn't fit, right,
especially if it doesn't find the file to patch?
- Why not -N, too?
- Is p1 always the correct parent length? That should be mentioned as a
prerequisite for patch dirs.
- Why not support more arguments to specify the patch mode to use?

function apply_patch_dir() {
local pdir=$1; shift
[ -d "$SPELL_DIRECTORY/$pdir" ] || return 1
find "$SPELL_DIRECTORY/$pdir" \( -name \*.patch -o -name \*.diff \) -print0
|
sort -zV | xargs -0 -n 1 -t patch -fp1 "$@" -i
}

(And bonus: I wonder if we really should encourage file names with
carriage returns in them.)


Alrighty then,

Thomas

Attachment: pgpPhv_fY003Y.pgp
Description: Digitale Signatur von OpenPGP




Archive powered by MHonArc 2.6.24.

Top of Page