diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2012-05-07 17:55:30 (GMT) |
---|---|---|
committer | Mark Brand <mabrand@mabrand.nl> | 2012-06-13 16:22:32 (GMT) |
commit | cd9cfc088b7b585400aa740dca95e7f85e21cdba (patch) | |
tree | f38d4b9f46f1f265547591e4b8e0f5384eb62125 | |
parent | 82947d8dd446d24127ba51a84456cd17f9e2843c (diff) | |
download | mxe-cd9cfc088b7b585400aa740dca95e7f85e21cdba.zip mxe-cd9cfc088b7b585400aa740dca95e7f85e21cdba.tar.gz mxe-cd9cfc088b7b585400aa740dca95e7f85e21cdba.tar.bz2 |
patch tool: check preconditions for import.
-rwxr-xr-x | tools/patch-tool-mxe | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/patch-tool-mxe b/tools/patch-tool-mxe index 48fec9c..5c9a86d 100755 --- a/tools/patch-tool-mxe +++ b/tools/patch-tool-mxe @@ -87,11 +87,22 @@ function export_patch { function import_patch { setupEnv - cd $gitsdir/$pkg_subdir && \ - cat $mxedir/src/$pkg-1-fixes.patch | \ - sed '/^From/,$ !d' | \ - sed s/'^From: .*'/"From: $author"/'g;' | \ - git am --keep-cr + if [ ! -d $gitsdir/$pkg_subdir ]; then + echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot import patches. Cancelling import - try 'init' first." >&2 + exit 1 + fi + + if [ -f $mxedir/src/$pkg-1-fixes.patch ]; then + cd $gitsdir/$pkg_subdir && \ + cat $mxedir/src/$pkg-1-fixes.patch | \ + sed '/^From/,$ !d' | \ + sed s/'^From: .*'/"From: $author"/'g;' | \ + git am --keep-cr && \ + echo "Imported $mxedir/src/$pkg-1-fixes.patch" + else + echo "patch-tool managed file $mxedir/src/$pkg-1-fixes.patch not found. Cancelling import." >&2 + exit 1 + fi } case "$cmd" in |