Advertisement
Guest User

Untitled

a guest
May 28th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #!/bin/bash
  2. applied=$(echo $1 | sed 's/.patch$/-applied\.patch/g')
  3. if [ ! -f "$1" ]; then
  4. echo "No patch found $1";
  5. exit 1;
  6. fi
  7. git am -3 $1 || (
  8. echo "Failures - Wiggling"
  9. errors=$(git apply --rej $1 2>&1)
  10. echo "$errors"
  11. (for i in $(find . -name \*.rej); do
  12. sed -e 's/^diff a\/\(.*\) b\/\(.*\)[[:space:]].*rejected.*$/--- \1\n+++ \2/' -i $i &&
  13. base=$(echo "$i" | sed 's/.rej//g')
  14. if [ -f "$i" ]; then
  15. wiggle -v --replace "$base" "$i"
  16. rm "$base.porig" "$i"
  17. else
  18. echo "COULD NOT FIND $base"
  19. fi
  20. done)
  21.  
  22. if [[ "$errors" == *"No such file"* ]]; then
  23. echo "===========================";
  24. echo " "
  25. echo " MISSING FILES"
  26. echo " "
  27. echo "===========================";
  28. fi
  29. )
  30. if [[ "$1" != *-applied.patch ]]; then
  31. mv "$1" "$applied"
  32. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement