-
Notifications
You must be signed in to change notification settings - Fork 894
/
Copy pathPushUpdate.cs
54 lines (51 loc) · 1.76 KB
/
PushUpdate.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using LibGit2Sharp.Core;
namespace LibGit2Sharp
{
/// <summary>
/// Represents an update which will be performed on the remote during push
/// </summary>
public class PushUpdate
{
internal PushUpdate(string srcRefName, ObjectId srcOid, string dstRefName, ObjectId dstOid)
{
DestinationObjectId = dstOid;
DestinationRefName = dstRefName;
SourceObjectId = srcOid;
SourceRefName = srcRefName;
}
internal unsafe PushUpdate(git_push_update* update)
{
DestinationObjectId = ObjectId.BuildFromPtr(&update->dst);
DestinationRefName = LaxUtf8Marshaler.FromNative(update->dst_refname);
SourceObjectId = ObjectId.BuildFromPtr(&update->src);
SourceRefName = LaxUtf8Marshaler.FromNative(update->src_refname);
}
/// <summary>
/// Empty constructor to support test suites
/// </summary>
protected PushUpdate()
{
DestinationObjectId = ObjectId.Zero;
DestinationRefName = string.Empty;
SourceObjectId = ObjectId.Zero;
SourceRefName = string.Empty;
}
/// <summary>
/// The source name of the reference
/// </summary>
public readonly string SourceRefName;
/// <summary>
/// The name of the reference to update on the server
/// </summary>
public readonly string DestinationRefName;
/// <summary>
/// The current target of the reference
/// </summary>
public readonly ObjectId SourceObjectId;
/// <summary>
/// The new target for the reference
/// </summary>
public readonly ObjectId DestinationObjectId;
}
}