Featured post
Pre-commit SVN Hook + image optimization script -
i wondering if had tried make pre-commit svn hook "smush" images before commit using smushit, punypng or optimization script.
i tried looking on google looks nobody ever tried this.
i need advices and/or feedbacks.
thanks !
pre-commit hooks should not modify transaction committed. svn book:
while hook scripts can anything, there 1 dimension in hook script authors should show restraint: not modify commit transaction using hook scripts. while might tempting use hook scripts automatically correct errors, shortcomings, or policy violations present in files being committed, doing can cause problems. subversion keeps client-side caches of bits of repository data, , if change commit transaction in way, caches become indetectably stale. inconsistency can lead surprising , unexpected behavior. instead of modifying transaction, should validate transaction in pre-commit hook , reject commit if not meet desired requirements. bonus, users learn value of careful, compliance-minded work habits.
a safer alternative check images in pre-commit hook, , refuse commit if criteria not met. (you still have "smushing" script in project , committers have remember run manually before each commit involves images.)
if sure want modify commits on fly, might still able safely on client side. example, tortoisesvn has client-side hook scripts.
- Get link
- X
- Other Apps
Comments
Post a Comment