Skip to content

Commit 7fbaa66

Browse files
committed
fixup! WIP
1 parent 02e1f52 commit 7fbaa66

11 files changed

+46
-66
lines changed

LibGit2Sharp/Core/GitCloneOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal struct GitCloneOptions
1717
public uint Version;
1818

1919
public GitCheckoutOpts CheckoutOpts;
20-
public GitFetchOpts FetchOpts;
20+
public GitFetchOptions FetchOpts;
2121

2222
public int Bare;
2323
public GitCloneLocal Local;

LibGit2Sharp/Core/GitFetchOptions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace LibGit2Sharp.Core
4+
{
5+
[StructLayout(LayoutKind.Sequential)]
6+
internal class GitFetchOptions
7+
{
8+
public int Version = 1;
9+
public GitRemoteCallbacks RemoteCallbacks;
10+
public FetchPruneStrategy prune;
11+
public bool update_fetchhead = true;
12+
public TagFetchMode download_tags;
13+
}
14+
}

LibGit2Sharp/Core/GitFetchOpts.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ internal static extern int git_remote_delete(
10361036
internal static extern int git_remote_fetch(
10371037
RemoteSafeHandle remote,
10381038
ref GitStrArray refspecs,
1039-
GitFetchOpts fetch_opts,
1039+
GitFetchOptions fetch_opts,
10401040
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
10411041

10421042
[DllImport(libgit2)]

LibGit2Sharp/Core/Proxy.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,15 +2321,6 @@ public static void git_remote_rename(RepositorySafeHandle repo, string name, str
23212321
}
23222322
}
23232323

2324-
public static void git_remote_save(RemoteSafeHandle remote)
2325-
{
2326-
using (ThreadAffinity())
2327-
{
2328-
int res = NativeMethods.git_remote_save(remote);
2329-
Ensure.ZeroResult(res);
2330-
}
2331-
}
2332-
23332324
public static void git_remote_set_autotag(RepositorySafeHandle repo, string remote, TagFetchMode value)
23342325
{
23352326
NativeMethods.git_remote_set_autotag(repo, remote, value);

LibGit2Sharp/FetchPruneStrategy.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace LibGit2Sharp
2+
{
3+
public enum FetchPruneStrategy
4+
{
5+
/// <summary>
6+
/// Use the setting from the configuration
7+
/// </summary>
8+
Fallback = 0, // Default?
9+
10+
/// <summary>
11+
/// Force pruning on
12+
/// </summary>
13+
Prune,
14+
15+
/// <summary>
16+
/// Force pruning off
17+
/// </summary>
18+
NoPrune,
19+
}
20+
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<Compile Include="CommitSortStrategies.cs" />
7171
<Compile Include="CompareOptions.cs" />
7272
<Compile Include="Core\FileHistory.cs" />
73-
<Compile Include="Core\GitFetchOpts.cs" />
73+
<Compile Include="Core\GitFetchOptions.cs" />
7474
<Compile Include="Core\Platform.cs" />
7575
<Compile Include="Core\Handles\ConflictIteratorSafeHandle.cs" />
7676
<Compile Include="DescribeOptions.cs" />
@@ -83,6 +83,7 @@
8383
<Compile Include="Core\Handles\IndexReucEntrySafeHandle.cs" />
8484
<Compile Include="EntryExistsException.cs" />
8585
<Compile Include="FetchOptionsBase.cs" />
86+
<Compile Include="FetchPruneStrategy.cs" />
8687
<Compile Include="LogEntry.cs" />
8788
<Compile Include="FollowFilter.cs" />
8889
<Compile Include="IBelongToARepository.cs" />

LibGit2Sharp/Network.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public virtual void Fetch(
192192
Ensure.ArgumentNotNull(url, "url");
193193
Ensure.ArgumentNotNull(refspecs, "refspecs");
194194

195-
DoFetch(repository.Handle, null, options, logMessage, refspecs);
195+
DoFetch(repository.Handle, null, url, options, logMessage, refspecs);
196196
}
197197

198198
/// <summary>

LibGit2Sharp/RemoteCollection.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ internal Remote RemoteForName(string name, bool shouldThrowIfNotFound = true)
5757
/// <returns>The updated remote.</returns>
5858
public virtual Remote Update(Remote remote, params Action<RemoteUpdater>[] actions)
5959
{
60-
using (var updater = new RemoteUpdater(this.repository, remote))
60+
var updater = new RemoteUpdater(repository, remote);
61+
62+
foreach (Action<RemoteUpdater> action in actions)
6163
{
62-
foreach (Action<RemoteUpdater> action in actions)
63-
{
64-
action(updater);
65-
}
64+
action(updater);
6665
}
6766

6867
return this[remote.Name];

LibGit2Sharp/RemoteUpdater.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ namespace LibGit2Sharp
99
/// <summary>
1010
/// Exposes properties of a remote that can be updated.
1111
/// </summary>
12-
public class RemoteUpdater : IDisposable
12+
public class RemoteUpdater
1313
{
1414
private readonly UpdatingCollection<string> fetchRefSpecs;
1515
private readonly UpdatingCollection<string> pushRefSpecs;
16-
private readonly RemoteSafeHandle remoteHandle;
1716
private readonly Repository repo;
1817
private readonly Remote remote;
1918

@@ -33,8 +32,6 @@ internal RemoteUpdater(Repository repo, Remote remote)
3332

3433
fetchRefSpecs = new UpdatingCollection<string>(GetFetchRefSpecs, SetFetchRefSpecs);
3534
pushRefSpecs = new UpdatingCollection<string>(GetPushRefSpecs, SetPushRefSpecs);
36-
37-
remoteHandle = Proxy.git_remote_lookup(repo.Handle, remote.Name, true);
3835
}
3936

4037
private IEnumerable<string> GetFetchRefSpecs()
@@ -45,7 +42,6 @@ private IEnumerable<string> GetFetchRefSpecs()
4542
private void SetFetchRefSpecs(IEnumerable<string> value)
4643
{
4744
Proxy.git_remote_set_fetch_refspecs(remoteHandle, value);
48-
Proxy.git_remote_save(remoteHandle);
4945
}
5046

5147
private IEnumerable<string> GetPushRefSpecs()
@@ -56,7 +52,6 @@ private IEnumerable<string> GetPushRefSpecs()
5652
private void SetPushRefSpecs(IEnumerable<string> value)
5753
{
5854
Proxy.git_remote_set_push_refspecs(remoteHandle, value);
59-
Proxy.git_remote_save(remoteHandle);
6055
}
6156

6257
/// <summary>
@@ -78,7 +73,6 @@ public virtual string Url
7873
set
7974
{
8075
Proxy.git_remote_set_url(repo.Handle, remote.Name, value);
81-
Proxy.git_remote_save(remoteHandle);
8276
}
8377
}
8478

@@ -90,7 +84,6 @@ public virtual string PushUrl
9084
set
9185
{
9286
Proxy.git_remote_set_pushurl(repo.Handle, remote.Name, value);
93-
Proxy.git_remote_save(remoteHandle);
9487
}
9588
}
9689

@@ -192,13 +185,5 @@ private void Save()
192185
setter(list.Value);
193186
}
194187
}
195-
196-
/// <summary>
197-
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
198-
/// </summary>
199-
public void Dispose()
200-
{
201-
remoteHandle.Dispose();
202-
}
203188
}
204189
}

LibGit2Sharp/TagFetchMode.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public enum TagFetchMode
1111
/// </summary>
1212
Fallback = 0, // GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK
1313

14+
15+
1416
/// <summary>
1517
/// Will automatically retrieve tags that
1618
/// point to objects retrieved during this fetch.

0 commit comments

Comments
 (0)