commit - dd4a654777079dd93bcf6c4aef22141460c154c0
commit + 3d69ad8dfb2fedd8d5abee1365505c2479e00180
blob - 1d163b44fd009159ceb946a0b633b9078cb6a7ef (mode 644)
blob + 715b19e7c0796c190b6a68be4e36bcb3dde4df4d (mode 640)
--- lib/worktree.c
+++ lib/worktree.c
if (status == GOT_STATUS_DELETE &&
staged_status != GOT_STATUS_NO_CHANGE)
return NULL;
+
+ if (status == GOT_STATUS_UNVERSIONED)
+ return (*a->progress_cb)(a->progress_arg,
+ GOT_STATUS_UNVERSIONED, relpath);
ie = got_fileindex_entry_get(a->fileindex, relpath, strlen(relpath));
if (ie == NULL)
blob - 170bc3b29f399c15ed51b80c19922e0d5c6ba58b (mode 755)
blob + 03dde3689850691152912cff6e55604338fb960b (mode 740)
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
diff -u $testroot/content.expected $testroot/content
fi
test_done "$testroot" "$ret"
+}
+
+function test_revert_directory_unknown {
+ local testroot=`test_init revert_directory_unknown`
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "modified alpha" > $testroot/wt/alpha
+ echo "new untracked file" > $testroot/wt/epsilon/new_file
+ echo "modified epsilon/zeta" > $testroot/wt/epsilon/zeta
+
+ (cd $testroot/wt && got revert -R . > $testroot/stdout)
+
+ echo 'R alpha' > $testroot/stdout.expected
+ echo '? epsilon/new_file' >> $testroot/stdout.expected
+ echo 'R epsilon/zeta' >> $testroot/stdout.expected
+ 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
+
+ echo "new untracked file" > $testroot/content.expected
+ cat $testroot/wt/epsilon/new_file > $testroot/content
+
+ cmp -s $testroot/content.expected $testroot/content
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/content.expected $testroot/content
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo "zeta" > $testroot/content.expected
+ cat $testroot/wt/epsilon/zeta > $testroot/content
+ cmp -s $testroot/content.expected $testroot/content
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/content.expected $testroot/content
+ fi
+
+ test_done "$testroot" "$ret"
}
function test_revert_patch {
run_test test_revert_file_in_new_subdir
run_test test_revert_no_arguments
run_test test_revert_directory
+run_test test_revert_directory_unknown
run_test test_revert_patch
run_test test_revert_patch_added
run_test test_revert_patch_removed