aboutsummaryrefslogtreecommitdiff
path: root/src/is_updated.c
blob: 5fce96bdf4ad34836495ba46f8e4594c99e58f39 (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;
}