Created
December 25, 2008 21:40
-
-
Save offby1/39957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Your challenge: figure out why the "sleep-for" in the emacs lisp | |
# below seems to return in far less than five seconds | |
EMACS=/usr/local/src/emacs-with-my-tweaks.git/src/emacs | |
cd /tmp | |
rm -rf xyzzy test-output | |
mkdir xyzzy | |
cd xyzzy | |
git init | |
mkdir Jack Jill | |
touch Jack/it Jill/it | |
git add . | |
git commit -m "golly!" | |
echo More stuff >> Jack/it | |
cd Jill | |
git status | |
cat > /tmp/test.el <<EOF | |
(defvar *dir* "/tmp/xyzzy/Jill" | |
"Directory in which we will run a test of vc-dir") | |
(cd *dir*) | |
(condition-case error | |
(progn | |
(vc-dir *dir*) | |
;; Apparently, vc-dir updates its buffer asynchronously, so we | |
;; have to sleep for a little while after calling it, but before | |
;; taking a snapshot of the vc-dir buffer -- lest that buffer be | |
;; incorrect. | |
(sleep-for 5) | |
(write-region (point-min) (point-max) "/tmp/test-output") | |
(message "Life is good, apparently") | |
(kill-emacs 0)) | |
(error | |
(message "Got us an error: %s" error) | |
(kill-emacs 1))) | |
EOF | |
$EMACS --batch --load /tmp/test.el | |
echo "=============================" | |
cat /tmp/test-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time sh -x /usr/local/src/vc-git-exploration/vc-test.sh | |
+ EMACS=/usr/local/src/emacs-with-my-tweaks.git/src/emacs | |
+ cd /tmp | |
+ rm -rf xyzzy test-output | |
+ mkdir xyzzy | |
+ cd xyzzy | |
+ git init | |
Initialized empty Git repository in /tmp/xyzzy/.git/ | |
+ mkdir Jack Jill | |
+ touch Jack/it Jill/it | |
+ git add . | |
+ git commit -m golly! | |
[master (root-commit)]: created c07f664: "golly!" | |
0 files changed, 0 insertions(+), 0 deletions(-) | |
create mode 100644 Jack/it | |
create mode 100644 Jill/it | |
+ echo More stuff | |
+ cd Jill | |
+ git status | |
# On branch master | |
# Changed but not updated: | |
# (use "git add <file>..." to update what will be committed) | |
# (use "git checkout -- <file>..." to discard changes in working directory) | |
# | |
# modified: ../Jack/it | |
# | |
no changes added to commit (use "git add" and/or "git commit -a") | |
+ cat | |
+ /usr/local/src/emacs-with-my-tweaks.git/src/emacs --batch --load /tmp/test.el | |
Wrote /tmp/test-output | |
Life is good, apparently | |
+ echo ============================= | |
============================= | |
+ cat /tmp/test-output | |
VC backend : Git | |
Working dir: /tmp/xyzzy/Jill/ | |
Branch : master | |
real 0m0.306s | |
user 0m0.220s | |
sys 0m0.096s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment