commit 72fd46fa56e8a73262ff8901b7c93554b7bad3e6 from: Stefan Sperling date: Fri Sep 06 15:11:26 2019 UTC fix modified files not shown by 'got status' after committing staged changes commit - 361f1f401c5c6e87c01e86e266887fd5c775afc5 commit + 72fd46fa56e8a73262ff8901b7c93554b7bad3e6 blob - 71909fdc0e45cdb4a1f34f21237d4504b723d1aa blob + b6130cbd359e573de7f6dc6be70e481d25764d33 --- lib/worktree.c +++ lib/worktree.c @@ -3918,7 +3918,8 @@ done: static const struct got_error * update_fileindex_after_commit(struct got_pathlist_head *commitable_paths, - struct got_object_id *new_base_commit_id, struct got_fileindex *fileindex) + struct got_object_id *new_base_commit_id, struct got_fileindex *fileindex, + int have_staged_files) { const struct got_error *err = NULL; struct got_pathlist_entry *pe; @@ -3939,11 +3940,13 @@ update_fileindex_after_commit(struct got_pathlist_head GOT_FILEIDX_STAGE_NONE); err = got_fileindex_entry_update(ie, ct->ondisk_path, ct->staged_blob_id->sha1, - new_base_commit_id->sha1, 1); + new_base_commit_id->sha1, + !have_staged_files); } else err = got_fileindex_entry_update(ie, ct->ondisk_path, ct->blob_id->sha1, - new_base_commit_id->sha1, 1); + new_base_commit_id->sha1, + !have_staged_files); } else { err = got_fileindex_entry_alloc(&ie, ct->ondisk_path, pe->path, ct->blob_id->sha1, @@ -4282,7 +4285,7 @@ got_worktree_commit(struct got_object_id **new_commit_ goto done; err = update_fileindex_after_commit(&commitable_paths, *new_commit_id, - fileindex); + fileindex, have_staged_files); sync_err = sync_fileindex(fileindex, fileindex_path); if (sync_err && err == NULL) err = sync_err; @@ -4860,7 +4863,7 @@ rebase_commit(struct got_object_id **new_commit_id, goto done; err = update_fileindex_after_commit(&commitable_paths, *new_commit_id, - fileindex); + fileindex, 0); sync_err = sync_fileindex(fileindex, fileindex_path); if (sync_err && err == NULL) err = sync_err; blob - abe364148a3057cd534860385de545c80bb5367b blob + c847136cca4bae60bd72b654eb15593e7739fc09 --- regress/cmdline/stage.sh +++ regress/cmdline/stage.sh @@ -1382,8 +1382,10 @@ function test_stage_commit { return 1 fi - echo 'A epsilon/new' > $testroot/stdout.expected + echo 'M alpha' > $testroot/stdout.expected + echo 'A epsilon/new' >> $testroot/stdout.expected echo 'D epsilon/zeta' >> $testroot/stdout.expected + echo 'M foo' >> $testroot/stdout.expected echo 'M gamma/delta' >> $testroot/stdout.expected (cd $testroot/wt && got status > $testroot/stdout)