コード例 #1
0
        private static void ReleaseGVFSLock(bool unattended, string[] args, int pid, NamedPipeClient pipeClient)
        {
            string fullCommand = GenerateFullCommand(args);

            GVFSLock.ReleaseGVFSLock(
                unattended,
                pipeClient,
                fullCommand,
                pid,
                GVFSHooksPlatform.IsElevated(),
                GVFSHooksPlatform.IsConsoleOutputRedirectedToFile(),
                response =>
            {
                if (response == null || response.ResponseData == null)
                {
                    Console.WriteLine("\nError communicating with GVFS: Run 'gvfs status' to check the status of your repo");
                }
                else if (response.ResponseData.HasFailures)
                {
                    if (response.ResponseData.FailureCountExceedsMaxFileNames)
                    {
                        Console.WriteLine(
                            "\nGVFS failed to update {0} files, run 'git status' to check the status of files in the repo",
                            response.ResponseData.FailedToDeleteCount + response.ResponseData.FailedToUpdateCount);
                    }
                    else
                    {
                        string deleteFailuresMessage = BuildUpdatePlaceholderFailureMessage(response.ResponseData.FailedToDeleteFileList, "delete", "git clean -f ");
                        if (deleteFailuresMessage.Length > 0)
                        {
                            Console.WriteLine(deleteFailuresMessage);
                        }

                        string updateFailuresMessage = BuildUpdatePlaceholderFailureMessage(response.ResponseData.FailedToUpdateFileList, "update", "git checkout -- ");
                        if (updateFailuresMessage.Length > 0)
                        {
                            Console.WriteLine(updateFailuresMessage);
                        }
                    }
                }
            },
                gvfsEnlistmentRoot: null,
                waitingMessage: "Waiting for GVFS to parse index and update placeholder files",
                spinnerDelay: PostCommandSpinnerDelayMs);
        }