Open michalrus opened 6 years ago
@michalrus that's interesting - when you do git checkout src
are the files in src/
actually changing on disk? If so, it could be eluding FSNotify
, which is what we use to monitor file system events.
Yes, they are. git checkout src/
will revert all changed files in that directory to their last git-committed state.
Here’s a test script which you can run on your machine (it will create and run in a temporary directory (L5):
#!/bin/sh
set -o xtrace
cd "$(mktemp -d)" || exit 1
git init
echo 'some content' >a.txt
cat a.txt
git add .
git commit --no-gpg-sign -m 'Commit 1'
sos . -p '\.txt$' -c : </dev/stdin &
sosPid=$!
echo
sleep 2
echo
echo 'Will modify a.txt manually in 3 seconds…'
sleep 3
echo 'some more content' >>a.txt
md5sum a.txt
echo
sleep 2
echo 'Will `git checkout a.txt` in 3 seconds…'
sleep 3
git checkout a.txt
md5sum a.txt
echo
sleep 2
echo 'Probably `sos` was not triggered by the checkout; killing it.'
kill -INT $sosPid
It’s output on my machine:
sos
is only triggered for the manual modification,sos
is not triggered by git checkout
, as reported originally:
I’m using the latest HEAD, 85d40083ac893bebc3696ab48f223da8af928874.
I’m first modifying Main.hs 3 times in Emacs, and then switch to some other terminal and do
git checkout src/
and: