Skip to content

Commit db76f6e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pointers
2 parents d45523c + 45846e2 commit db76f6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1141
-728
lines changed

CHANGES.md

+56
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,62 @@
1010
- Windows (x86/amd64): <https://ci.appveyor.com/project/libgit2/libgit2sharp>
1111
- Linux/Mac OS X: <https://travis-ci.org/libgit2/libgit2sharp>
1212

13+
## v0.22 + 1
14+
15+
### Additions
16+
17+
### Changes
18+
19+
- Obsolete the config paths in RepositoryOptions
20+
21+
### Fixes
22+
23+
## v0.22 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.21.1...v0.22))
24+
25+
### Additions
26+
27+
- Add CustomHeaders in the push options (#1217)
28+
- Expose the minimal diff algorithm (#1229)
29+
- Expose Reset() with checkout options (#1219)
30+
- Add a prettify option to history rewrite options (#1185)
31+
- Add option to describe to only follow the first parent (#1190)
32+
- Allow setting the config search path (#1123)
33+
- Provide access to the remote's host HTTPS certificate (#1134)
34+
- Add support for rebase (#964)
35+
- ListReferences() now accepts a credentials provider (#1099)
36+
- Introduce FileStatus.Conflicted and introduce staging of conflicts (#1062)
37+
- Support streaming filters written in C# (#1030)
38+
- Add support for the pre-push callback (#1061)
39+
- Add support for listing remote references without a Repository instance (#1065)
40+
- Add StashCollection.Apply() and .Pop() (#1068)
41+
- Support retrieving a configuration for a repository without instantiating it (#1042)
42+
- Implement 'log --follow'-like functionality (#963)
43+
- Introduce in-memory merging via Repository.MergeCommits() (#990)
44+
- Allow setting whether to prune during a fetch (#1258)
45+
46+
### Changes
47+
48+
- Deprecate MergeConflictException in a backwards-compatible way (#1243)
49+
- Improve type safety in the generic type for Diff.Compare() (#1180)
50+
- Obsolete Repository.Commit(), NoteCollection.Add() and
51+
NoteCollection.Remove() overloads which do not require a signature (#1173)
52+
- BuildSignature() no longer tries to build a signature from the
53+
environment if there is none configured (#1171)
54+
- Rename the commit walker's Since to IncludeReachableFrom and Until to ExcludeReachableFrom (#1069)
55+
- Rename MergeConflictException to CheckoutConflictException to more
56+
accurately reflect what it means (#1059)
57+
- Specify the diff algorithm instead of setting a boolean to use patience (#1043)
58+
- Remove optional parameters (#1031)
59+
- Move Repository.Reset(paths) into Index (#959)
60+
- Move FindMergeBase() overloads to ObjectDatabase (#957)
61+
62+
### Fixes
63+
64+
- ListReferences() is now able to handle symbolic references (#1132)
65+
- Repository.IsValid() returns false on empty paths (#1156)
66+
- The included version of libgit2 includes racy-git support
67+
- Fix a racy NRE in the filters (#1113)
68+
1369
## v0.21.1 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.21...v0.21.1))
1470

1571
### Changes

LibGit2Sharp.Tests/AttributesFixture.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ public class AttributesFixture : BaseFixture
99
[Fact]
1010
public void StagingHonorsTheAttributesFiles()
1111
{
12-
string path = SandboxStandardTestRepo();
13-
using (var repo = new Repository(path))
12+
using (var repo = new Repository(InitNewRepository()))
1413
{
1514
CreateAttributesFile(repo);
1615

LibGit2Sharp.Tests/BranchFixture.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,10 @@ public void QueryRemoteForRemoteBranch()
447447
[Fact]
448448
public void QueryUnresolvableRemoteForRemoteBranch()
449449
{
450-
var path = SandboxStandardTestRepo();
451-
452450
var fetchRefSpecs = new string[] { "+refs/heads/notfound/*:refs/remotes/origin/notfound/*" };
453451

454-
using (var repo = InitIsolatedRepository(path))
452+
var path = SandboxStandardTestRepo();
453+
using (var repo = new Repository(path))
455454
{
456455
// Update the remote config such that the remote for a
457456
// remote branch cannot be resolved
@@ -472,12 +471,11 @@ public void QueryUnresolvableRemoteForRemoteBranch()
472471
[Fact]
473472
public void QueryAmbigousRemoteForRemoteBranch()
474473
{
475-
var path = SandboxStandardTestRepo();
476-
477474
const string fetchRefSpec = "+refs/heads/*:refs/remotes/origin/*";
478475
const string url = "http://github.com/libgit2/TestGitRepository";
479476

480-
using (var repo = InitIsolatedRepository(path))
477+
var path = SandboxStandardTestRepo();
478+
using (var repo = new Repository(path))
481479
{
482480
// Add a second remote so that it is ambiguous which remote
483481
// the remote-tracking branch tracks.

LibGit2Sharp.Tests/CommitFixture.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,10 @@ public void DirectlyAccessingAnUnknownTreeEntryOfTheCommitReturnsNull()
542542
public void CanCommitWithSignatureFromConfig()
543543
{
544544
string repoPath = InitNewRepository();
545-
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
546-
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };
547545

548-
using (var repo = new Repository(repoPath, options))
546+
using (var repo = new Repository(repoPath))
549547
{
548+
CreateConfigurationWithDummyUser(repo, Constants.Identity);
550549
string dir = repo.Info.Path;
551550
Assert.True(Path.IsPathRooted(dir));
552551
Assert.True(Directory.Exists(dir));

LibGit2Sharp.Tests/ConfigurationFixture.cs

+13-32
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,8 @@ public void CanUnsetAnEntryFromTheLocalConfiguration()
3636
[Fact]
3737
public void CanUnsetAnEntryFromTheGlobalConfiguration()
3838
{
39-
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
40-
41-
var options = BuildFakeConfigs(scd);
42-
4339
string path = SandboxBareTestRepo();
44-
using (var repo = new Repository(path, options))
40+
using (var repo = new Repository(path))
4541
{
4642
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
4743
Assert.Equal(42, repo.Config.Get<int>("Wow.Man-I-am-totally-global").Value);
@@ -143,12 +139,10 @@ public void CanReadStringValue()
143139
[Fact]
144140
public void CanEnumerateGlobalConfig()
145141
{
146-
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
147-
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };
148-
149142
var path = SandboxStandardTestRepoGitDir();
150-
using (var repo = new Repository(path, options))
143+
using (var repo = new Repository(path))
151144
{
145+
CreateConfigurationWithDummyUser(repo, Constants.Identity);
152146
var entry = repo.Config.FirstOrDefault<ConfigurationEntry<string>>(e => e.Key == "user.name");
153147
Assert.NotNull(entry);
154148
Assert.Equal(Constants.Signature.Name, entry.Value);
@@ -200,16 +194,14 @@ public void CanFindInLocalConfig()
200194
[Fact]
201195
public void CanFindInGlobalConfig()
202196
{
203-
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
204-
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };
205197

206198
var path = SandboxStandardTestRepoGitDir();
207-
using (var repo = new Repository(path, options))
199+
using (var repo = new Repository(path))
208200
{
209-
var matches = repo.Config.Find(@"\.name", ConfigurationLevel.Global);
201+
var matches = repo.Config.Find("-rocks", ConfigurationLevel.Global);
210202

211203
Assert.NotNull(matches);
212-
Assert.Equal(new[] { "user.name" },
204+
Assert.Equal(new[] { "woot.this-rocks" },
213205
matches.Select(m => m.Key).ToArray());
214206
}
215207
}
@@ -331,12 +323,8 @@ public void SettingUnsupportedTypeThrows()
331323
[Fact]
332324
public void CanGetAnEntryFromASpecificStore()
333325
{
334-
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
335-
336-
var options = BuildFakeConfigs(scd);
337-
338326
string path = SandboxStandardTestRepo();
339-
using (var repo = new Repository(path, options))
327+
using (var repo = new Repository(path))
340328
{
341329
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Local));
342330
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
@@ -356,12 +344,8 @@ public void CanGetAnEntryFromASpecificStore()
356344
[Fact]
357345
public void CanTellIfASpecificStoreContainsAKey()
358346
{
359-
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
360-
361-
var options = BuildFakeConfigs(scd);
362-
363347
string path = SandboxBareTestRepo();
364-
using (var repo = new Repository(path, options))
348+
using (var repo = new Repository(path))
365349
{
366350
Assert.True(repo.Config.HasConfig(ConfigurationLevel.System));
367351

@@ -387,16 +371,14 @@ public void CanAccessConfigurationWithoutARepository(Func<string, string> localC
387371
{
388372
var path = SandboxStandardTestRepoGitDir();
389373

390-
string globalConfigPath = CreateConfigurationWithDummyUser(Constants.Identity);
391-
var options = new RepositoryOptions { GlobalConfigurationLocation = globalConfigPath };
392-
393-
using (var repo = new Repository(path, options))
374+
using (var repo = new Repository(path))
394375
{
395376
repo.Config.Set("my.key", "local");
396377
repo.Config.Set("my.key", "mouse", ConfigurationLevel.Global);
397378
}
398379

399-
using (var config = Configuration.BuildFrom(localConfigurationPathProvider(path), globalConfigPath))
380+
var globalPath = Path.Combine(GlobalSettings.GetConfigSearchPaths(ConfigurationLevel.Global).Single(), ".gitconfig");
381+
using (var config = Configuration.BuildFrom(localConfigurationPathProvider(path), globalPath))
400382
{
401383
Assert.Equal("local", config.Get<string>("my.key").Value);
402384
Assert.Equal("mouse", config.Get<string>("my.key", ConfigurationLevel.Global).Value);
@@ -418,11 +400,10 @@ public void PassingANonExistingLocalConfigurationFileToBuildFromthrowss()
418400
public void CannotBuildAProperSignatureFromConfigWhenFullIdentityCannotBeFoundInTheConfig(string name, string email)
419401
{
420402
string repoPath = InitNewRepository();
421-
string configPath = CreateConfigurationWithDummyUser(name, email);
422-
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };
423403

424-
using (var repo = new Repository(repoPath, options))
404+
using (var repo = new Repository(repoPath))
425405
{
406+
CreateConfigurationWithDummyUser(repo, name, email);
426407
Assert.Equal(name, repo.Config.GetValueOrDefault<string>("user.name"));
427408
Assert.Equal(email, repo.Config.GetValueOrDefault<string>("user.email"));
428409

LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs

+6-25
Original file line numberDiff line numberDiff line change
@@ -1044,12 +1044,9 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny()
10441044
repo.Config.Unset("core.filemode");
10451045
}
10461046

1047-
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
1048-
1049-
var options = BuildFakeSystemConfigFilemodeOption(scd, true);
1050-
1051-
using (var repo = new Repository(path, options))
1047+
using (var repo = new Repository(path))
10521048
{
1049+
SetFilemode(repo, true);
10531050
var changes = repo.Diff.Compare<TreeChanges>(new[] { file });
10541051

10551052
Assert.Equal(1, changes.Count());
@@ -1059,34 +1056,18 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny()
10591056
Assert.Equal(Mode.NonExecutableFile, change.Mode);
10601057
}
10611058

1062-
options = BuildFakeSystemConfigFilemodeOption(scd, false);
1063-
1064-
using (var repo = new Repository(path, options))
1059+
using (var repo = new Repository(path))
10651060
{
1061+
SetFilemode(repo, false);
10661062
var changes = repo.Diff.Compare<TreeChanges>(new[] { file });
10671063

10681064
Assert.Equal(0, changes.Count());
10691065
}
10701066
}
10711067

1072-
private RepositoryOptions BuildFakeSystemConfigFilemodeOption(
1073-
SelfCleaningDirectory scd,
1074-
bool value)
1068+
void SetFilemode(Repository repo, bool value)
10751069
{
1076-
Directory.CreateDirectory(scd.DirectoryPath);
1077-
1078-
var options = new RepositoryOptions
1079-
{
1080-
SystemConfigurationLocation = Path.Combine(
1081-
scd.RootedDirectoryPath, "fake-system.config")
1082-
};
1083-
1084-
StringBuilder sb = new StringBuilder()
1085-
.AppendFormat("[core]{0}", Environment.NewLine)
1086-
.AppendFormat("filemode = {1}{0}", Environment.NewLine, value);
1087-
Touch("", options.SystemConfigurationLocation, sb.ToString());
1088-
1089-
return options;
1070+
repo.Config.Set("core.filemode", value);
10901071
}
10911072

10921073
[Fact]

LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs

+6-25
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,9 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny()
127127
repo.Config.Unset("core.filemode", ConfigurationLevel.Local);
128128
}
129129

130-
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
131-
132-
var options = BuildFakeSystemConfigFilemodeOption(scd, true);
133-
134-
using (var repo = new Repository(path, options))
130+
using (var repo = new Repository(path))
135131
{
132+
SetFilemode(repo, true);
136133
var changes = repo.Diff.Compare<TreeChanges>(new[] { file });
137134

138135
Assert.Equal(1, changes.Count());
@@ -142,34 +139,18 @@ public void ComparingReliesOnProvidedConfigEntriesIfAny()
142139
Assert.Equal(Mode.NonExecutableFile, change.Mode);
143140
}
144141

145-
options = BuildFakeSystemConfigFilemodeOption(scd, false);
146-
147-
using (var repo = new Repository(path, options))
142+
using (var repo = new Repository(path))
148143
{
144+
SetFilemode(repo, false);
149145
var changes = repo.Diff.Compare<TreeChanges>(new[] { file });
150146

151147
Assert.Equal(0, changes.Count());
152148
}
153149
}
154150

155-
private RepositoryOptions BuildFakeSystemConfigFilemodeOption(
156-
SelfCleaningDirectory scd,
157-
bool value)
151+
void SetFilemode(Repository repo, bool value)
158152
{
159-
Directory.CreateDirectory(scd.DirectoryPath);
160-
161-
var options = new RepositoryOptions
162-
{
163-
SystemConfigurationLocation = Path.Combine(
164-
scd.RootedDirectoryPath, "fake-system.config")
165-
};
166-
167-
StringBuilder sb = new StringBuilder()
168-
.AppendFormat("[core]{0}", Environment.NewLine)
169-
.AppendFormat("filemode = {1}{0}", Environment.NewLine, value);
170-
File.WriteAllText(options.SystemConfigurationLocation, sb.ToString());
171-
172-
return options;
153+
repo.Config.Set("core.filemode", value);
173154
}
174155

175156
[Fact]

LibGit2Sharp.Tests/FetchFixture.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ public void FetchHonorsTheFetchPruneConfigurationEntry()
213213

214214
string clonedRepoPath = Repository.Clone(url, scd.DirectoryPath);
215215

216-
var options = BuildFakeConfigs(BuildSelfCleaningDirectory());
217-
218-
using (var clonedRepo = new Repository(clonedRepoPath, options))
216+
using (var clonedRepo = new Repository(clonedRepoPath))
219217
{
220218
Assert.Equal(5, clonedRepo.Branches.Count(b => b.IsRemote));
221219

0 commit comments

Comments
 (0)