@@ -1772,6 +1772,18 @@ public static ObjectId git_stash_save(
1772
1772
return new ObjectId ( stashOid ) ;
1773
1773
}
1774
1774
}
1775
+
1776
+ public static ICollection < TResult > git_stash_foreach < TResult > (
1777
+ RepositorySafeHandle repo ,
1778
+ Func < int , IntPtr , GitOid , TResult > resultSelector )
1779
+ {
1780
+ return git_foreach (
1781
+ resultSelector ,
1782
+ c => NativeMethods . git_stash_foreach (
1783
+ repo , ( UIntPtr i , IntPtr m , ref GitOid x , IntPtr p ) => c ( ( int ) i , m , x , p ) , IntPtr . Zero ) ,
1784
+ GitErrorCode . NotFound ) ;
1785
+ }
1786
+
1775
1787
#endregion
1776
1788
1777
1789
#region git_status_
@@ -2039,6 +2051,30 @@ private static ICollection<TResult> git_foreach<T1, T2, TResult>(
2039
2051
}
2040
2052
}
2041
2053
2054
+ private static ICollection < TResult > git_foreach < T1 , T2 , T3 , TResult > (
2055
+ Func < T1 , T2 , T3 , TResult > resultSelector ,
2056
+ Func < Func < T1 , T2 , T3 , IntPtr , int > , int > iterator ,
2057
+ params GitErrorCode [ ] ignoredErrorCodes )
2058
+ {
2059
+ using ( ThreadAffinity ( ) )
2060
+ {
2061
+ var result = new List < TResult > ( ) ;
2062
+ var res = iterator ( ( w , x , y , payload ) =>
2063
+ {
2064
+ result . Add ( resultSelector ( w , x , y ) ) ;
2065
+ return 0 ;
2066
+ } ) ;
2067
+
2068
+ if ( ignoredErrorCodes != null && ignoredErrorCodes . Contains ( ( GitErrorCode ) res ) )
2069
+ {
2070
+ return new TResult [ 0 ] ;
2071
+ }
2072
+
2073
+ Ensure . ZeroResult ( res ) ;
2074
+ return result ;
2075
+ }
2076
+ }
2077
+
2042
2078
public delegate TResult Func < T1 , T2 , T3 , T4 , T5 , TResult > ( T1 arg1 , T2 arg2 , T3 arg3 , T4 arg4 , T5 arg5 ) ;
2043
2079
2044
2080
private static ICollection < TResult > git_foreach < T1 , T2 , T3 , T4 , TResult > (
0 commit comments