commit a484d721b0152ab353a510e75b2aab3cd1aebee3 from: Stefan Sperling date: Mon Jun 10 10:10:37 2019 UTC don't report base-bump-only updates as 'already up to date' commit - 1a36436d4d4024fada20498cad3039950c4b2da2 commit + a484d721b0152ab353a510e75b2aab3cd1aebee3 blob - 96fece4634c0766c9a3aaef60f3df693fc56fc11 blob + 01f304f9b44e4b62576f8d26aca2b3756f8d99b0 --- got/got.c +++ got/got.c @@ -284,6 +284,10 @@ static void 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 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); blob - 6ab8418c059fa507bf8dfbb1f840b9f94d47a5d3 blob + 2dd6e8cfae54c6bc3ebc6d27f919785066d57529 --- include/got_worktree.h +++ 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. blob - acc38bf248e0148b45afacb9d4c7f2ae7db08b60 blob + d541a30b5fbfe09481bfcf827b523db052fb9afb --- lib/worktree.c +++ 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_en } 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 *workt 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: blob - 07a2d33972a8a0313ab84aa837a7724d06cc13bc blob + ce179b0abdbeedd05c12868f359472f1a1517349 --- regress/cmdline/update.sh +++ 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