-
Notifications
You must be signed in to change notification settings - Fork 894
/
Copy pathRewriteHistoryOptions.cs
89 lines (79 loc) · 3.31 KB
/
RewriteHistoryOptions.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
namespace LibGit2Sharp
{
/// <summary>
/// Options for a RewriteHistory operation.
/// </summary>
public sealed class RewriteHistoryOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="RewriteHistoryOptions"/> class.
/// </summary>
public RewriteHistoryOptions()
{
BackupRefsNamespace = "refs/original/";
}
/// <summary>
/// Namespace where rewritten references should be stored.
/// (required; default: "refs/original/")
/// </summary>
public string BackupRefsNamespace { get; set; }
/// <summary>
/// Rewriter for commit metadata.
/// </summary>
public Func<Commit, CommitRewriteInfo> CommitHeaderRewriter { get; set; }
/// <summary>
/// Rewriter for mangling parent links.
/// </summary>
public Func<Commit, IEnumerable<Commit>> CommitParentsRewriter { get; set; }
/// <summary>
/// Rewriter for commit trees.
/// </summary>
public Func<Commit, TreeDefinition> CommitTreeRewriter { get; set; }
/// <summary>
/// Rewriter for tag names. This is called with
/// (OldTag.Name, OldTag.IsAnnotated, OldTarget.Identifier).
/// OldTarget.Identifier is either the SHA of a direct reference,
/// or the canonical name of a symbolic reference.
/// </summary>
public Func<string, bool, string, string> TagNameRewriter { get; set; }
/// <summary>
/// Empty commits should be removed while rewriting.
/// </summary>
public bool PruneEmptyCommits { get; set; }
/// <summary>
/// Action to exectute after rewrite succeeds,
/// but before it is finalized.
/// <para>
/// An exception thrown here will rollback the operation.
/// This is useful to inspect the new state of the repository
/// and throw if you need to adjust and try again.
/// </para>
/// </summary>
public Action OnSucceeding { get; set; }
/// <summary>
/// Action to execute if an error occurred during rewrite,
/// before rollback of rewrite progress.
/// Does not fire for exceptions thrown in <see cref="OnSucceeding" />.
/// <para>
/// This is useful to inspect the state of the repository
/// at the time of the exception for troubleshooting.
/// It is not meant to be used for general error handling;
/// for that use <code>try</code>/<code>catch</code>.
/// </para>
/// <para>
/// An exception thrown here will replace the original exception.
/// You may want to pass the callback exception as an <code>innerException</code>.
/// </para>
/// </summary>
public Action<Exception> OnError { get; set; }
/// <summary>
/// Specifies Commit message prettifying behavior during rewrite.
/// NOTE: Prettifying may result in losing one or multiple lines in the commit message.
/// As such it is recommended to leave this set to false.
/// </summary>
/// <value><c>true</c> if Commit messages are prettified; otherwise, <c>false</c>.</value>
public bool PrettifyMessages { get; set; }
}
}