Skip to content

Commit 8d9fdc9

Browse files
committed
Add GIT_EUSER to OdbBackend exposed return codes
1 parent cfd3c03 commit 8d9fdc9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

LibGit2Sharp.Tests/OdbBackendFixture.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,14 @@ public override int ReadStream(ObjectId oid, out OdbBackendStream stream)
311311

312312
public override int ForEach(ForEachCallback callback)
313313
{
314-
foreach (var mockGitObject in m_objectIdToContent)
314+
foreach (var objectId in m_objectIdToContent.Keys)
315315
{
316-
callback(mockGitObject.Key);
316+
int result = callback(objectId);
317+
318+
if (result != (int)ReturnCode.GIT_OK)
319+
{
320+
return result;
321+
}
317322
}
318323

319324
return (int)ReturnCode.GIT_OK;

LibGit2Sharp/OdbBackend.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,11 @@ protected enum ReturnCode
650650
/// The given short oid is ambiguous.
651651
/// </summary>
652652
GIT_EAMBIGUOUS = -5,
653+
654+
/// <summary>
655+
/// Interruption of the foreach() callback is requested.
656+
/// </summary>
657+
GIT_EUSER = -7,
653658
}
654659
}
655660
}

0 commit comments

Comments
 (0)