commit - cf61d8187fe29b5d3333c3103bc73ad3ca585efc
commit + 784955db0f639c53fd5aeb70d0f006cad99a815f
blob - cabd57bcdcc7027bcfd2382910f6e65e30e1208f
blob + 51c16a1695e0a21b815ddbead9a928ea07ae238e
--- got/got.c
+++ got/got.c
static void
update_progress(void *arg, unsigned char status, const char *path)
{
+ int *did_something = arg;
+
if (status == GOT_STATUS_EXISTS)
return;
+ *did_something = 1;
while (path[0] == '/')
path++;
printf("%c %s\n", status, path);
char *worktree_path = NULL;
struct got_object_id *commit_id = NULL;
char *commit_id_str = NULL;
- int ch;
+ int ch, did_something = 0;
while ((ch = getopt(argc, argv, "c:")) != -1) {
switch (ch) {
}
error = got_worktree_checkout_files(worktree, repo,
- update_progress, NULL, checkout_cancel, NULL);
+ update_progress, &did_something, checkout_cancel, NULL);
if (error != NULL)
goto done;
- printf("Updated to commit %s\n", commit_id_str);
+ if (did_something)
+ printf("Updated to commit %s\n", commit_id_str);
+ else
+ printf("Already up-to-date\n");
done:
free(worktree_path);
free(commit_id);