From 23788484d173501d03ecdb162255fd90481d1246 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 29 Sep 2025 16:20:06 +0200 Subject: [PATCH] Fix new tree deletion --- Octokit/Models/Request/NewTreeItem.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Octokit/Models/Request/NewTreeItem.cs b/Octokit/Models/Request/NewTreeItem.cs index 738b21c5..83de6b6f 100644 --- a/Octokit/Models/Request/NewTreeItem.cs +++ b/Octokit/Models/Request/NewTreeItem.cs @@ -1,6 +1,7 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using Octokit.Internal; namespace Octokit { @@ -16,9 +17,9 @@ namespace Octokit public string Path { get; set; } /// - /// String of the file mode - one of 100644 for file (blob), - /// 100755 for executable (blob), 040000 for subdirectory (tree), - /// 160000 for submodule (commit) or + /// String of the file mode - one of 100644 for file (blob), + /// 100755 for executable (blob), 040000 for subdirectory (tree), + /// 160000 for submodule (commit) or /// 120000 for a blob that specifies the path of a symlink /// public string Mode { get; set; } @@ -31,11 +32,12 @@ namespace Octokit /// /// The SHA for this Tree item. + /// If both this and Content is null it will delete the item. /// - public string Sha { get; set; } + [SerializeNull] public string Sha { get; set; } /// - /// Gets or sets the content you want this file to have. GitHub will write this blob out and use that SHA + /// Gets or sets the content you want this file to have. GitHub will write this blob out and use that SHA /// for this entry. Use either this, or tree.sha. /// /// @@ -48,4 +50,4 @@ namespace Octokit get { return string.Format(CultureInfo.InvariantCulture, "SHA: {0}, Path: {1}, Type: {2}", Sha, Path, Type); } } } -} \ No newline at end of file +}