diff --git a/Server/Git/AbstractGit.cs b/Server/Git/AbstractGit.cs index d2d1a00..c5feb06 100644 --- a/Server/Git/AbstractGit.cs +++ b/Server/Git/AbstractGit.cs @@ -95,15 +95,43 @@ namespace Server.Git //string EncryptoExcel = crypto.Compress(excel); //암호화 ProtocolProcessor.cryptoData = crypto.Compress(excel); - // 스테이징 - RepositorySet("add .", repositoryPath); - // 커밋 - RepositorySet($"commit -m \"update excel data\"", repositoryPath); + //초기세팅일 경우 데이터를 받아오고 아닐경우 데이터를저장 + if(ProtocolProcessor.version == "") + { + string versionFilePath = Path.Combine(repositoryPath, "version"); + if (File.Exists(versionFilePath)) + { + using (StreamReader reader = new StreamReader(repositoryPath + @"version")) + { + ProtocolProcessor.version = reader.ReadToEnd(); + } + } + else + { + Console.WriteLine("version file is null"); + return; + } - // 푸시 - RepositorySet("push origin main", repositoryPath); + } + else + { + using (StreamWriter writer = new StreamWriter(repositoryPath + @"version")) + { + writer.Write(ProtocolProcessor.version); + } + //버전 정보가 있을때만 커밋 + + // 스테이징 + RepositorySet("add .", repositoryPath); + + // 커밋 + RepositorySet($"commit -m \"update excel data\"", repositoryPath); + + // 푸시 + RepositorySet("push origin main", repositoryPath); + } } /// diff --git a/Server/Service/Downlode.cs b/Server/Service/Downlode.cs index 7fff0e7..93d8509 100644 --- a/Server/Service/Downlode.cs +++ b/Server/Service/Downlode.cs @@ -27,6 +27,7 @@ namespace Server.Service { DownlodeResp resp = new DownlodeResp(); resp.data = data; + resp.version = ProtocolProcessor.version; resp.status = 200; return resp.ToJson(); } @@ -39,8 +40,6 @@ namespace Server.Service public string version; public override bool IsReceivedAllField() { - if (version == "") - return false; return true; } } @@ -48,5 +47,6 @@ namespace Server.Service public class DownlodeResp : Resp { public string data; + public string version; } } diff --git a/Server/System/GItWebhook.cs b/Server/System/GItWebhook.cs index db54063..ebc05ce 100644 --- a/Server/System/GItWebhook.cs +++ b/Server/System/GItWebhook.cs @@ -60,6 +60,7 @@ namespace Server.System { git = new XlsxToJson(); thread = new Thread(git.Init); + successResp = new ErrorResp(); successResp.status = 200; successResp.message = "Success"; thread.Start(); diff --git a/Server/obj/Debug/net6.0/Server.dll b/Server/obj/Debug/net6.0/Server.dll index 9fb47d6..3408f0f 100644 Binary files a/Server/obj/Debug/net6.0/Server.dll and b/Server/obj/Debug/net6.0/Server.dll differ diff --git a/Server/obj/Debug/net6.0/ref/Server.dll b/Server/obj/Debug/net6.0/ref/Server.dll index 50b8e6f..3c5e51e 100644 Binary files a/Server/obj/Debug/net6.0/ref/Server.dll and b/Server/obj/Debug/net6.0/ref/Server.dll differ diff --git a/Server/obj/Debug/net6.0/refint/Server.dll b/Server/obj/Debug/net6.0/refint/Server.dll index 50b8e6f..3c5e51e 100644 Binary files a/Server/obj/Debug/net6.0/refint/Server.dll and b/Server/obj/Debug/net6.0/refint/Server.dll differ diff --git a/Server/obj/staticwebassets.pack.sentinel b/Server/obj/staticwebassets.pack.sentinel index e888935..1b8a711 100644 --- a/Server/obj/staticwebassets.pack.sentinel +++ b/Server/obj/staticwebassets.pack.sentinel @@ -136,3 +136,6 @@ 2.0 2.0 2.0 +2.0 +2.0 +2.0