aboutsummaryrefslogtreecommitdiff
path: root/src/is_updated.c
blob: 68e6d2e18f92c020851ef1b42cdb541c70baa856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>

#include "is_updated.h"
#include "cmd_out.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;
}