Hi Team,
I have integrated bitbucket in our application and I am trying to add a folder that contains approx. 400+ .md files using git command (add *) programmatically using C# code, but these files remains untracked. It works fine for .txt and .json files.
Below is the sample code :
bitbucketService.ExecuteGitWindowsCommand(mainDirectory, $"checkout -b {BranchName}");
//Code to copy some extra file and folders that contains .md file in checkout branch.
.
.
.
//Code to add .md files using git command
bitbucketService.ExecuteGitWindowsCommand(mainDirectory, @$"add *");
public string ExecuteGitWindowsCommand(string workingDirectory, string arguments)
{
string command_result;
Process ps = new Process();
ps.StartInfo.FileName = GitExePath;
ps.StartInfo.UseShellExecute = false;
ps.StartInfo.RedirectStandardOutput = true;
ps.StartInfo.RedirectStandardInput = true;
ps.StartInfo.RedirectStandardError = true;
ps.StartInfo.WorkingDirectory = workingDirectory;
ps.StartInfo.Arguments = arguments;
ps.Start();
command_result = ps.StandardOutput.ReadToEnd();
ps.StandardInput.WriteLine("exit");
ps = null;
return command_result;
}
It works fine for .txt and .json files. but if the folder contains more(25+) .md files then it get fail or stuck at code command_result = ps.StandardOutput.ReadToEnd();
Any help would be apricated thanks.
Hey @Ajay kumar
I'm not a novice in C# but can you try out the below and see if it works
See if it works for 1 *.md file and then check for how many max number of *.md files.
If the above is working, you may need to perform this operation in batches.
If any of the above steps are not working, specify the exact file name and try out performing git add
Let me know
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.