This commit is contained in:
50
push.c
50
push.c
@@ -1,29 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
char path[100] = "/home/zaine/master-folder/org-platform/org_web";
|
||||
int main(void)
|
||||
{
|
||||
char path[] = "/home/zaine/master-folder/org-platform/org_web";
|
||||
char command[256];
|
||||
int result;
|
||||
|
||||
char command[200];
|
||||
snprintf(command, sizeof(command),
|
||||
"cd \"%s\" && git add .",
|
||||
path);
|
||||
result = system(command);
|
||||
if (result != 0) {
|
||||
printf("git add failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(command, sizeof(command), "cd %s && git add .", path);
|
||||
snprintf(command, sizeof(command),
|
||||
"cd \"%s\" && git commit -m \"Auto commit\"",
|
||||
path);
|
||||
result = system(command);
|
||||
if (result != 0) {
|
||||
printf("git commit failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int result = system(command);
|
||||
snprintf(command, sizeof(command),
|
||||
"cd \"%s\" && git push",
|
||||
path);
|
||||
result = system(command);
|
||||
if (result != 0) {
|
||||
printf("git push failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(command, sizeof(command), "cd %s && git commit -m \"Auto commit", path);
|
||||
|
||||
result = system(command);
|
||||
|
||||
snprintf(command, sizeof(command), "cd %s && git push", path);
|
||||
|
||||
result = system(command);
|
||||
|
||||
if (result == 0) {
|
||||
printf("Successfully pushed files to git.\n");
|
||||
} else {
|
||||
printf("Failed to push files to git.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user