update-patches-git 709 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. #
  3. # Update patches using git-format-patch from a source tree prepared by
  4. # patch_git.sh.
  5. #
  6. # (c) 2016 Phil Sutter <phil@nwl.cc>
  7. wrkdist=$1
  8. wd=$(pwd)
  9. cd "$wrkdist"
  10. top=""
  11. top_series=""
  12. git log --grep="^OpenADK patch marker:" --oneline | while read hash subject; do
  13. [ -n "$top" ] || {
  14. top=$hash
  15. top_series="${subject#OpenADK patch marker: }"
  16. continue
  17. }
  18. bottom=$hash
  19. bottom_series="${subject#OpenADK patch marker: }"
  20. patchdir=$(<.git/patch_tmp/${top_series}/__patchdir__)
  21. while read patchfile; do
  22. rm ${patchdir}/$patchfile
  23. done < .git/patch_tmp/${top_series}/__patchfiles__
  24. git format-patch -N -o "$patchdir" ${bottom}..${top}
  25. top=$bottom
  26. top_series=$bottom_series
  27. done