Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d4dee19
Move Cache after the actual Present state
smashwilson Apr 24, 2017
9998834
Use Keys constants and functions as cache keys
smashwilson Apr 24, 2017
9d23779
Pending tests for using and invalidating the Repository cache
smashwilson Apr 24, 2017
71b259b
Test cache invalidation for a file staging event
smashwilson Apr 24, 2017
29243d1
Populate the cache invalidation decorations
smashwilson Apr 24, 2017
7123b1e
Invalidate correct keys for FilePatch operations
smashwilson Apr 24, 2017
ead66fa
Accept fs events within .git/refs/heads
smashwilson Apr 25, 2017
b849ec6
Use didChange() methods
smashwilson Apr 25, 2017
5b56a7a
observeFilesystemChange accepts an argument
smashwilson Apr 25, 2017
6e8f493
First pass at cache invalidation from filesystem events
smashwilson Apr 25, 2017
eeda89c
Fixture repository with both multiple files and commits
smashwilson Apr 25, 2017
bc1dc43
:gear: Automated-ish cache invalidation test framework
smashwilson Apr 25, 2017
da930a2
Use non-arrow functions for helpers
smashwilson Apr 26, 2017
34f233b
Capture errors from Repository options
smashwilson Apr 26, 2017
77230f9
Allow expected options to not change when uncached
smashwilson Apr 26, 2017
e3a4d82
Staging, unstaging, commit and merge operations
smashwilson Apr 26, 2017
003a05e
Tune invalidated cache keys
smashwilson Apr 26, 2017
39946c0
Use identity comparison of Promises to locate cache invalidations
smashwilson Apr 26, 2017
d3f0940
Use cached status results for isPartiallyStaged
smashwilson Apr 26, 2017
9248fa6
:fire: obsolete verbose caching tests
smashwilson Apr 26, 2017
941591e
Don't check isPartiallyStaged for cache ops
smashwilson Apr 26, 2017
dc833f6
Accept a "files" array
smashwilson Apr 26, 2017
d77e2fa
Allow skipped operations
smashwilson Apr 26, 2017
213e169
Back to green
smashwilson Apr 26, 2017
2c32666
Fetching, pushing, pulling
smashwilson Apr 26, 2017
b941244
Invalidate specific config options
smashwilson Apr 27, 2017
27d973f
stagedChangesSinceParentCommit can't be changed by a workdir op
smashwilson Apr 27, 2017
f74467b
Accept an array of config options to test
smashwilson Apr 27, 2017
d2fd249
Final two operations :tada:
smashwilson Apr 27, 2017
501f587
:fire: unused code
smashwilson Apr 27, 2017
9a0a102
The first filesystem event test
smashwilson Apr 27, 2017
a938b56
Allow test cases to invalidate *more* than necessary without failing
smashwilson Apr 27, 2017
20e83d3
Correct a race condition in getCurrentBranch()
smashwilson Apr 27, 2017
a9ff5c4
Invalidate lastCommit on refs/heads events
smashwilson Apr 27, 2017
41ff751
Oops, got the error message backwards
smashwilson Apr 27, 2017
8da28cc
Support an existing workdir in wireUpObserver()
smashwilson Apr 27, 2017
514115b
:fire: {verbose: true} argument
smashwilson Apr 27, 2017
0da1e9a
Filesystem event tests
smashwilson Apr 27, 2017
ba656b8
:fire: console.log
smashwilson Apr 27, 2017
3b8b2a5
:shirt: no shadowing variables
smashwilson Apr 27, 2017
c89880e
:fire: unused default @invalidate() arg
smashwilson Apr 27, 2017
f49cee0
Evict groups of cache keys more efficiently
smashwilson Apr 27, 2017
9286631
Bweep bweep, typo alert
smashwilson Apr 27, 2017
8900307
Filesystem events trigger observeFilesystemChange, not refresh
smashwilson Apr 27, 2017
6cdef7d
Merge branch 'master' of github.com:atom/github into aw-selective-inv…
smashwilson Apr 27, 2017
6ddee89
Let's see what's happening to those events on Windows
smashwilson Apr 27, 2017
6747f43
Fire eventCallback() even if all events are received before test
smashwilson Apr 27, 2017
87a06e3
:fire: console
smashwilson Apr 27, 2017
17c697f
I have a bajillion commits but it's only because I can't type
smashwilson Apr 27, 2017
0aa21db
wake up Travis
smashwilson Apr 27, 2017
aa4a3b6
Merge branch 'master' of github.com:atom/github into aw-selective-inv…
smashwilson Apr 28, 2017
c7dbc40
Restore missing "await"
smashwilson May 2, 2017
effc03d
Only update if there's an actual change
smashwilson May 2, 2017
dc37811
:fire: `expected` lists and pending tests
smashwilson May 2, 2017
1f10db8
Merge branch 'master' into aw-selective-invalidation
smashwilson May 2, 2017
56db6fd
Account for repository destruction
smashwilson May 2, 2017
45a7572
Update Keys invalidated for writeMergeConflictToIndex
smashwilson May 2, 2017
a5e9503
Cache invalidation test for writeMergeConflictToIndex()
smashwilson May 3, 2017
d09bf26
Merge branch 'master' of github.com:atom/github into aw-selective-inv…
smashwilson May 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/git-shell-out-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,17 @@ export default class GitShellOutStrategy {
* Branches
*/
async getCurrentBranch() {
const content = await readFile(path.join(this.workingDir, '.git', 'HEAD'));
if (content.startsWith('ref: ')) {
try {
// The common case: you're on a branch
return {
name: (await this.exec(['symbolic-ref', '--short', 'HEAD'])).trim(),
isDetached: false,
};
} else {
} catch (e) {
if (!/not a symbolic ref/.test(e.stdErr)) {
throw e;
}

// Detached HEAD
return {
name: (await this.exec(['describe', '--contains', '--all', 'HEAD'])).trim(),
Expand Down
6 changes: 3 additions & 3 deletions lib/models/file-system-change-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ export default class FileSystemChangeObserver {
const isNonGitFile = event => !event.directory.split(path.sep).includes('.git') && event.file !== '.git';
const isWatchedGitFile = event => {
return ['config', 'index', 'HEAD', 'MERGE_HEAD'].includes(event.file || event.newFile) ||
event.directory.includes(path.join('.git', 'refs', 'remotes'));
event.directory.includes(path.join('.git', 'refs'));
};
const filteredEvents = events.filter(e => isNonGitFile(e) || isWatchedGitFile(e));
if (filteredEvents.length) {
this.logger.showEvents(filteredEvents);
this.emitter.emit('did-change');
this.didChange(filteredEvents);
const workdirOrHeadEvent = filteredEvents.find(e => !['config', 'index'].includes(e.file || e.newFile));
if (workdirOrHeadEvent) {
this.logger.showWorkdirOrHeadEvents();
this.emitter.emit('did-change-workdir-or-head');
this.didChangeWorkdirOrHead();
}
}
},
Expand Down
Loading