Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not triggered for git checkout #28

Open
michalrus opened this issue Dec 29, 2017 · 3 comments
Open

Not triggered for git checkout #28

michalrus opened this issue Dec 29, 2017 · 3 comments

Comments

@michalrus
Copy link

I’m using the latest HEAD, 85d4008.

I’m first modifying Main.hs 3 times in Emacs, and then switch to some other terminal and do git checkout src/ and:

$ cd some-project/
$ sos src/ -p '\.hs$' -e '/\.#' -e '/flycheck_' -c :        Hit Ctrl+C to quit.

Modified: src/Main.hs
[1/1] :
Success ✓

Modified: src/Main.hs
[1/1] :
Success ✓

Modified: src/Main.hs
[1/1] :
Success ✓


# now I’ll do git checkout src/


# nothing happened
^C
@schell
Copy link
Owner

schell commented Dec 29, 2017

@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.

@michalrus
Copy link
Author

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:

@michalrus
Copy link
Author

↑ posted haskell-fswatch/hfsnotify#72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants