mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
style: add .editorconfig for code formatting. see issu #25
This commit is contained in:
parent
a8eeea4f78
commit
18aaa0a143
225 changed files with 7781 additions and 3911 deletions
|
@ -1,38 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
public static class Discard {
|
||||
public static void All(string repo) {
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public static class Discard
|
||||
{
|
||||
public static void All(string repo)
|
||||
{
|
||||
new Reset(repo, "HEAD", "--hard").Exec();
|
||||
new Clean(repo).Exec();
|
||||
}
|
||||
|
||||
public static void ChangesInWorkTree(string repo, List<Models.Change> changes) {
|
||||
public static void ChangesInWorkTree(string repo, List<Models.Change> changes)
|
||||
{
|
||||
var needClean = new List<string>();
|
||||
var needCheckout = new List<string>();
|
||||
|
||||
foreach (var c in changes) {
|
||||
if (c.WorkTree == Models.ChangeState.Untracked || c.WorkTree == Models.ChangeState.Added) {
|
||||
foreach (var c in changes)
|
||||
{
|
||||
if (c.WorkTree == Models.ChangeState.Untracked || c.WorkTree == Models.ChangeState.Added)
|
||||
{
|
||||
needClean.Add(c.Path);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
needCheckout.Add(c.Path);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < needClean.Count; i += 10) {
|
||||
for (int i = 0; i < needClean.Count; i += 10)
|
||||
{
|
||||
var count = Math.Min(10, needClean.Count - i);
|
||||
new Clean(repo, needClean.GetRange(i, count)).Exec();
|
||||
}
|
||||
|
||||
for (int i = 0; i < needCheckout.Count; i += 10) {
|
||||
for (int i = 0; i < needCheckout.Count; i += 10)
|
||||
{
|
||||
var count = Math.Min(10, needCheckout.Count - i);
|
||||
new Checkout(repo).Files(needCheckout.GetRange(i, count));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangesInStaged(string repo, List<Models.Change> changes) {
|
||||
for (int i = 0; i < changes.Count; i += 10) {
|
||||
public static void ChangesInStaged(string repo, List<Models.Change> changes)
|
||||
{
|
||||
for (int i = 0; i < changes.Count; i += 10)
|
||||
{
|
||||
var count = Math.Min(10, changes.Count - i);
|
||||
var files = new List<string>();
|
||||
for (int j = 0; j < count; j++) files.Add(changes[i + j].Path);
|
||||
|
@ -40,4 +52,4 @@ namespace SourceGit.Commands {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue