|
32 | 32 | });
|
33 | 33 |
|
34 | 34 | it(@"should create a stash with modified file content", ^{
|
35 |
| - NSURL *fileURL = [repository.fileURL URLByAppendingPathComponent:@"README.md"]; |
| 35 | + NSURL *fileURL = [repository.workingDirectoryURL URLByAppendingPathComponent:@"README.md"]; |
36 | 36 | NSString *newContent = @"foobar";
|
37 | 37 |
|
38 | 38 | NSString *oldContent = [NSString stringWithContentsOfURL:fileURL encoding:NSUTF8StringEncoding error:NULL];
|
|
50 | 50 | });
|
51 | 51 |
|
52 | 52 | it(@"should create a stash with uncommitted changes", ^{
|
53 |
| - NSURL *fileURL = [repository.fileURL URLByAppendingPathComponent:@"README.md"]; |
| 53 | + NSURL *fileURL = [repository.workingDirectoryURL URLByAppendingPathComponent:@"README.md"]; |
54 | 54 | NSString *newContent = @"foobar";
|
55 | 55 |
|
56 | 56 | NSString *oldContent = [NSString stringWithContentsOfURL:fileURL encoding:NSUTF8StringEncoding error:NULL];
|
|
68 | 68 | });
|
69 | 69 |
|
70 | 70 | it(@"should fail to create a stash with an untracked file using default options", ^{
|
71 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 71 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
72 | 72 |
|
73 | 73 | NSError *error = nil;
|
74 | 74 | GTCommit *stash = [repository stashChangesWithMessage:nil flags:GTRepositoryStashFlagDefault error:&error];
|
|
80 | 80 | });
|
81 | 81 |
|
82 | 82 | it(@"should stash an untracked file when enabled", ^{
|
83 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 83 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
84 | 84 |
|
85 | 85 | NSError *error = nil;
|
86 | 86 | GTCommit *stash = [repository stashChangesWithMessage:nil flags:GTRepositoryStashFlagIncludeUntracked error:&error];
|
|
94 | 94 |
|
95 | 95 | for (int i = stashCount; i >= 0; i--) {
|
96 | 96 | NSString *filename = [NSString stringWithFormat:@"new-test-file-%i", i];
|
97 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 97 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
98 | 98 |
|
99 | 99 | NSString *message = [NSString stringWithFormat:@"stash %i", i];
|
100 | 100 |
|
|
121 | 121 | });
|
122 | 122 |
|
123 | 123 | it(@"should apply stashes", ^{
|
124 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 124 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
125 | 125 |
|
126 | 126 | NSError *error = nil;
|
127 | 127 | GTCommit *stash = [repository stashChangesWithMessage:nil flags:GTRepositoryStashFlagIncludeUntracked error:&error];
|
|
136 | 136 | expect(@(progressCalled)).to(beTruthy());
|
137 | 137 | expect(error).to(beNil());
|
138 | 138 |
|
139 |
| - expect([NSString stringWithContentsOfURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] encoding:NSUTF8StringEncoding error:NULL]).to(equal(@"foobar")); |
| 139 | + expect([NSString stringWithContentsOfURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] encoding:NSUTF8StringEncoding error:NULL]).to(equal(@"foobar")); |
140 | 140 | });
|
141 | 141 |
|
142 | 142 |
|
143 | 143 | it(@"should drop stashes", ^{
|
144 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 144 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
145 | 145 |
|
146 | 146 | NSError *error = nil;
|
147 | 147 | GTCommit *stash = [repository stashChangesWithMessage:nil flags:GTRepositoryStashFlagIncludeUntracked error:&error];
|
|
176 | 176 | });
|
177 | 177 |
|
178 | 178 | it(@"should fail to apply conflicting stashes", ^{
|
179 |
| - expect(@([@"foobar" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 179 | + expect(@([@"foobar" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
180 | 180 |
|
181 | 181 | NSError *error = nil;
|
182 | 182 | GTCommit *stash = [repository stashChangesWithMessage:nil flags:GTRepositoryStashFlagIncludeUntracked error:&error];
|
183 | 183 | expect(stash).notTo(beNil());
|
184 | 184 | expect(error).to(beNil());
|
185 | 185 |
|
186 | 186 |
|
187 |
| - expect(@([@"barfoo" writeToURL:[repository.fileURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
| 187 | + expect(@([@"barfoo" writeToURL:[repository.workingDirectoryURL URLByAppendingPathComponent:@"new-test-file"] atomically:YES encoding:NSUTF8StringEncoding error:NULL])).to(beTruthy()); |
188 | 188 |
|
189 | 189 | BOOL success = [repository applyStashAtIndex:0 flags:GTRepositoryStashApplyFlagDefault checkoutOptions:nil error:&error progressBlock:nil];
|
190 | 190 | expect(@(success)).to(beFalsy());
|
|
0 commit comments