From 450625de1dccd8cdcc418d672ac740a455bd4339 Mon Sep 17 00:00:00 2001 From: Kevin Zhuang Date: Tue, 7 Jul 2020 15:18:43 +1000 Subject: [PATCH] test(funtrack): update funtrack test --- scripts/fstat | 4 ++-- scripts/funtrack | 6 +++--- tests/funtrack.bats | 10 +++++----- tests/fzf | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/fstat b/scripts/fstat index 772f081..e9e9a83 100755 --- a/scripts/fstat +++ b/scripts/fstat @@ -77,8 +77,8 @@ while :; do ) if [[ -z "${stage_file}" ]]; then - /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" reset --quiet HEAD "${selected_filenames[@]}" + git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" reset --quiet HEAD "${selected_filenames[@]}" else - /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" add "${selected_filenames[@]}" + git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" add "${selected_filenames[@]}" fi done diff --git a/scripts/funtrack b/scripts/funtrack index bf2fbd4..2820fd0 100755 --- a/scripts/funtrack +++ b/scripts/funtrack @@ -78,7 +78,7 @@ if [[ "${track_type}" == "temp" ]]; then [[ -z "${confirm}" ]] && echo "(dryrun) dotbare update-index --assume-unchanged" "${selected_files[@]}" [[ -z "${confirm}" ]] && confirm=$(get_confirmation "Files will be temporarily stop being tracked for changes, continue?") [[ "${confirm}" != 'y' ]] && exit 1 - /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" update-index --assume-unchanged "${selected_files[@]}" + git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" update-index --assume-unchanged "${selected_files[@]}" echo -e " " echo "Selected files are temporarily untracked by git, use dotbare funtrack -r to continue tracking changes." echo "Although dotbare funtrack -t won't delete the files on other machines, it is not the recommended way to untrack files." @@ -88,7 +88,7 @@ elif [[ "${track_type}" == "retrack" ]]; then [[ -z "${confirm}" ]] && echo "(dryrun) dotbare update-index --no-assume-unchanged" "${selected_files[@]}" [[ -z "${confirm}" ]] && confirm=$(get_confirmation "Files will resume being tracked by git, continue?") [[ "${confirm}" != 'y' ]] && exit 1 - /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" update-index --no-assume-unchanged "${selected_files[@]}" + git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" update-index --no-assume-unchanged "${selected_files[@]}" echo " " echo "Selected files are being resumed for tracking by git." echo "Although dotbare funtrack -t won't delete the files on other machines, it is not the recommended way to untrack files." @@ -98,7 +98,7 @@ else [[ -z "${confirm}" ]] && echo "(dryrun) dotbare rm --cached" "${selected_files[@]}" [[ -z "${confirm}" ]] && confirm=$(get_confirmation "Untrack the selected files?") [[ "${confirm}" != 'y' ]] && exit 1 - /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" rm --cached "${selected_files[@]}" + git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" rm --cached "${selected_files[@]}" echo -e " " echo "Selected files are being untracked by git, make sure to run dotbare fbackup on your other systems." echo "When other systems pull down this change, selected files will be deleted on other systems." diff --git a/tests/funtrack.bats b/tests/funtrack.bats index 4abe10c..2ccc617 100755 --- a/tests/funtrack.bats +++ b/tests/funtrack.bats @@ -38,18 +38,18 @@ resume_track() { @test "funtrack untrack file" { run untrack_file - [ "${status}" -eq 128 ] + [[ "${output}" =~ "rm --cached" ]] [[ "${output}" =~ "funtrack_file" ]] } @test "funtrack temp untrack" { run temp_untrack - [ "${status}" -eq 128 ] - [[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]] + [[ "${output}" =~ "update-index --assume-unchanged" ]] + [[ "${output}" =~ "funtrack_file" ]] } @test "funtrack resume track" { run resume_track - [ "${status}" -eq 128 ] - [[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]] + [[ "${output}" =~ "update-index --no-assume-unchanged" ]] + [[ "${output}" =~ "funtrack_file" ]] } diff --git a/tests/fzf b/tests/fzf index a2278f1..b915274 100755 --- a/tests/fzf +++ b/tests/fzf @@ -48,7 +48,7 @@ elif [[ "$*" =~ "--no-multi --header=commit --flog_reset" ]]; then elif [[ "$*" =~ '--header=select a commit' ]] && [[ "$*" =~ "show --color" ]]; then # dotbare flog --reset -y -- "./flog.bats" @test "flog reset" echo "--flog_reset" -elif [[ "$*" =~ "--header=select files to untrack" ]] && [[ "$*" =~ "cat ${DOTBARE_TREE}/{}" ]]; then +elif [[ "$*" =~ "--header=select files to untrack" ]] && [[ "$*" =~ "preview.sh ${DOTBARE_TREE}/{}" ]]; then # dotbare funtrack -- "./funtrack.bats" @test "funtrack untrack file" echo "funtrack_file" elif [[ "$*" =~ '--header=select files to add to a stash' ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then