aboutsummaryrefslogtreecommitdiff
path: root/src/is_updated.c
blob: 29b482dec2c9e1c91bea13d474e40a8171781f6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}