@@ -24,9 +24,6 @@ describe('GitDiff when targeting nested repository', () => {
24
24
// The nested repo doesn't need to be managed by the temp module because
25
25
// it's a part of our test environment.
26
26
const nestedPath = path . join ( projectPath , 'nested-repository' ) ;
27
- // When instantiating a GitRepository, the repository will always point
28
- // to the .git folder in it's path.
29
- const targetRepositoryPath = path . join ( nestedPath , '.git' ) ;
30
27
// Initialize the repository contents.
31
28
fs . copySync ( path . join ( __dirname , 'fixtures' , 'working-dir' ) , nestedPath ) ;
32
29
fs . moveSync (
@@ -58,15 +55,20 @@ describe('GitDiff when targeting nested repository', () => {
58
55
* Non-hack regression prevention for nested repositories. If we know
59
56
* that our project path contains two repositories, we can ensure that
60
57
* git-diff is targeting the correct one by creating an artificial change
61
- * in the ancestor repository, which doesn't effect the target repository.
62
- * If our diff shows any kind of change to our target file, we're targeting
63
- * the incorrect repository.
58
+ * in the ancestor repository, which is percieved differently within the
59
+ * child. In this case, creating a new file will not generate markers in
60
+ * the ancestor repo, even if there are changes; but changes will be
61
+ * marked within the child repo. So all we have to do is check if
62
+ * markers exist and we know we're targeting the proper repository,
63
+ * If no markers exist, we're targeting an ancestor repo.
64
64
*/
65
- it ( "uses the innermost repository" , ( ) => {
66
- //waitsForPromise(async () => await new Promise(resolve => setTimeout(resolve, 4000)));
67
- //waitsFor(() => !! atom.packages.isPackageLoaded("git-diff"));
65
+ it ( 'uses the innermost repository' , ( ) => {
66
+ editor . insertText ( 'a' ) ;
68
67
waitsFor ( ( ) => screenUpdates > 0 ) ;
69
- runs ( ( ) => expect ( editor . getMarkers ( ) . length ) . toBe ( 0 ) ) ;
68
+ runs ( ( ) => {
69
+ expect ( editorElement . querySelectorAll ( '.git-line-modified' ) . length )
70
+ . toBe ( 1 ) ;
71
+ } ) ;
70
72
} ) ;
71
73
} ) ;
72
74
} ) ;
0 commit comments