コード例 #1
0
 internal PushUpdate(GitPushUpdate update)
 {
     DestinationObjectId = update.dst;
     DestinationRefName  = LaxUtf8Marshaler.FromNative(update.dst_refname);
     SourceObjectId      = update.src;
     SourceRefName       = LaxUtf8Marshaler.FromNative(update.src_refname);
 }
コード例 #2
0
        private int GitPushNegotiationHandler(IntPtr updates, UIntPtr len, IntPtr payload)
        {
            if (updates == IntPtr.Zero)
            {
                return((int)GitErrorCode.Error);
            }

            bool result = false;

            try
            {
                int          length      = len.ConvertToInt();
                PushUpdate[] pushUpdates = new PushUpdate[length];

                unsafe
                {
                    IntPtr *ptr = (IntPtr *)updates.ToPointer();

                    for (int i = 0; i < length; i++)
                    {
                        if (ptr[i] == IntPtr.Zero)
                        {
                            throw new NullReferenceException("Unexpected null git_push_update pointer was encountered");
                        }

                        GitPushUpdate gitPushUpdate = ptr[i].MarshalAs <GitPushUpdate>();
                        PushUpdate    pushUpdate    = new PushUpdate(gitPushUpdate);
                        pushUpdates[i] = pushUpdate;
                    }

                    result = PrePushCallback(pushUpdates);
                }
            }
            catch (Exception exception)
            {
                Log.Write(LogLevel.Error, exception.ToString());
                Proxy.giterr_set_str(GitErrorCategory.Callback, exception);
                result = false;
            }

            return(Proxy.ConvertResultToCancelFlag(result));
        }