fix a status bug exposed by test_update_conflict_wt_rm_vs_repo_rm
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
diff --git a/lib/worktree.c b/lib/worktree.c
index 4101d79..697a915 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -2263,18 +2263,9 @@ worktree_status(struct got_worktree *worktree, const char *path,
workdir = opendir(ondisk_path);
if (workdir == NULL) {
if (errno == ENOTDIR || errno == ENOENT) {
- struct got_fileindex_entry *ie;
- ie = got_fileindex_entry_get(fileindex, path);
- if (ie == NULL)
- err = (*status_cb)(status_arg,
- GOT_STATUS_UNVERSIONED, path, NULL, NULL);
- else
- err = report_file_status(ie, ondisk_path,
- status_cb, status_arg, repo);
- if (err)
- goto done;
- err = report_file_status(ie, ondisk_path,
- status_cb, status_arg, repo);
+ err = report_file_status(
+ got_fileindex_entry_get(fileindex, path),
+ ondisk_path, status_cb, status_arg, repo);
goto done;
} else {
err = got_error_from_errno2("opendir", ondisk_path);
diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh
index ce179b0..e3be1a7 100755
--- a/regress/cmdline/update.sh
+++ b/regress/cmdline/update.sh
@@ -1052,8 +1052,17 @@ function test_update_conflict_wt_rm_vs_repo_rm {
fi
# beta is now gone... we don't flag tree conflicts yet
- echo 'got: bad path' > $testroot/stderr.expected
- (cd $testroot/wt && got status beta 2> $testroot/stderr)
+ echo -n > $testroot/stdout.expected
+ echo -n > $testroot/stderr.expected
+ (cd $testroot/wt && got status beta > $testroot/stdout \
+ 2> $testroot/stderr)
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
cmp -s $testroot/stderr.expected $testroot/stderr
ret="$?"
if [ "$ret" != "0" ]; then