aboutsummaryrefslogtreecommitdiff
path: root/src/is_updated.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/is_updated.c')
-rw-r--r--src/is_updated.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/is_updated.c b/src/is_updated.c
new file mode 100644
index 0000000..29b482d
--- /dev/null
+++ b/src/is_updated.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#include "is_updated.h"
+#include "cmd_out.h"
+#include "vars.h"
+
+bool is_updated(const char *src) {
+ if (src && strlen(src) > 0 && chdir(src) != 0) {
+ return false;
+ }
+
+ char *output = cmd_out("git pull");
+ bool result = (strstr(output, "Already up to date.") != NULL);
+ free(output);
+ return result;
+} \ No newline at end of file