don't report base-bump-only updates as 'already up to date'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
diff --git a/got/got.c b/got/got.c
index 96fece4..01f304f 100644
--- a/got/got.c
+++ b/got/got.c
@@ -285,6 +285,10 @@ checkout_progress(void *arg, unsigned char status, const char *path)
{
char *worktree_path = arg;
+ /* Base commit bump happens silently. */
+ if (status == GOT_STATUS_BUMP_BASE)
+ return;
+
while (path[0] == '/')
path++;
@@ -567,6 +571,11 @@ update_progress(void *arg, unsigned char status, const char *path)
return;
*did_something = 1;
+
+ /* Base commit bump happens silently. */
+ if (status == GOT_STATUS_BUMP_BASE)
+ return;
+
while (path[0] == '/')
path++;
printf("%c %s\n", status, path);
diff --git a/include/got_worktree.h b/include/got_worktree.h
index 6ab8418..2dd6e8c 100644
--- a/include/got_worktree.h
+++ b/include/got_worktree.h
@@ -31,6 +31,7 @@ struct got_commitable;
#define GOT_STATUS_OBSTRUCTED '~'
#define GOT_STATUS_REVERT 'R'
#define GOT_STATUS_CANNOT_DELETE 'd'
+#define GOT_STATUS_BUMP_BASE 'b'
/*
* Attempt to initialize a new work tree on disk.
diff --git a/lib/worktree.c b/lib/worktree.c
index acc38bf..d541a30 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1460,6 +1460,8 @@ struct bump_base_commit_id_arg {
const char *path;
size_t path_len;
const char *entry_name;
+ got_worktree_checkout_cb progress_cb;
+ void *progress_arg;
};
/* Bump base commit ID of all files within an updated part of the work tree. */
@@ -1474,6 +1476,7 @@ bump_base_commit_id(void *arg, struct got_fileindex_entry *ie)
} else if (!got_path_is_child(ie->path, a->path, a->path_len))
return NULL;
+ (*a->progress_cb)(a->progress_arg, GOT_STATUS_BUMP_BASE, ie->path);
memcpy(ie->commit_sha1, a->base_commit_id->sha1, SHA1_DIGEST_LENGTH);
return NULL;
}
@@ -1644,6 +1647,8 @@ got_worktree_checkout_files(struct got_worktree *worktree, const char *path,
bbc_arg.entry_name = entry_name;
bbc_arg.path = path;
bbc_arg.path_len = strlen(path);
+ bbc_arg.progress_cb = progress_cb;
+ bbc_arg.progress_arg = progress_arg;
err = got_fileindex_for_each_entry_safe(fileindex,
bump_base_commit_id, &bbc_arg);
sync:
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index 07a2d33..ce179b0 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -1470,7 +1470,9 @@ function test_update_bumps_base_commit_id {
(cd $testroot/wt && got update > $testroot/stdout)
- echo "Already up-to-date" > $testroot/stdout.expected
+ echo -n "Updated to commit " >> $testroot/stdout.expected
+ git_show_head $testroot/repo >> $testroot/stdout.expected
+ echo >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
if [ "$ret" != "0" ]; then