Reputation: 15579
I want to run a command lazily on my CI server if and only if there is a change in a subdirectory (between the two latest commits), preferably using git diff.
Upvotes: 0
Views: 57
Reputation: 6517
You can use some kind of a file system watcher (like, for example inotifywait) to do the trick.
Upvotes: 1
Reputation: 15579
[[ -z "$(git diff --numstat your-sub-folder)" ]] || echo "Changes"
Will run git diff in a subshell, comparing content in "your-sub-folder", and echo Changes if there are any changes detected.
Upvotes: 0