mirror of
https://github.com/kazhala/dotbare
synced 2024-11-02 09:40:27 +00:00
docs(changlog): update new changes
fix: test .. test: improve wording and variable names in test .. ..
This commit is contained in:
parent
549545526a
commit
542bc0838c
31
CHANGELOG.md
31
CHANGELOG.md
@ -2,7 +2,32 @@
|
||||
|
||||
Noteble changes are documentated in this file.
|
||||
|
||||
## 1.0.0
|
||||
## 2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- `dotbare` now accept verbose type of argument e.g. `dotbare fadd --file` `dotbare fcheckout --branch`.
|
||||
More information please refer to each commands help manual
|
||||
- Added support for handling files with spaces
|
||||
- Improved unittest with mocking
|
||||
- A more reliable `dotbare fupgrade` behavior
|
||||
- Added version flag for `dotbare`
|
||||
|
||||
### Changed
|
||||
|
||||
- `dotbare fcheckout -a` has now been renamed to `dotbare fcheckout -s` or `dotbare fcheckout --select`
|
||||
- `dotbare fstash -f` has now been renamed to `dotbare fstash -s` or `dotbare fstash --select`
|
||||
- `dotbare funtrack -s` has now been renamed to `dotbare funtrack -t` or `dotbare funtrack --temp`
|
||||
- `dotbare funtrack -S` has now been renamed to `dotbare funtrack -r` or `dotbare funtrack --resume`
|
||||
- dryrun information no longer will display if `-y` or `--yes` flag has been passed
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed `-a` flag of `dotbare freset`. It's not working as intended because I misunderstand it, the intended
|
||||
behavior is actually achieved by `dotbare fcheckout -a`, use `dotbare fcheckout -a` instead.
|
||||
(Edit: `dotbare fcheckout -a` is now `dotbare fcheckout -s` or `dotbare fcheckout --select`)
|
||||
|
||||
## 1.1.0
|
||||
|
||||
### Added
|
||||
|
||||
@ -21,5 +46,5 @@ Noteble changes are documentated in this file.
|
||||
|
||||
- Removed global .gitignore manipulation during migration, not needed. Added .gitignore tips to README and
|
||||
let user handle it
|
||||
- Removed `-a` flag of `dotbare freset`. It's not working as intended because I misunderstand git, the intended
|
||||
behavior is actually achieved by `dotbare fcheckout -a`, use `dotbare fcheckout -a` instead.
|
||||
|
||||
## 1.0.0
|
||||
|
4
dotbare
4
dotbare
@ -61,9 +61,7 @@ case "$1" in
|
||||
exit 0
|
||||
;;
|
||||
-v|--version)
|
||||
cd "${mydir}" || exit
|
||||
dotbare_version=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
||||
printf "Current dotbare version: %s\n" "${dotbare_version}"
|
||||
echo "Current dotbare version: ${DOTBARE_VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
|
@ -15,6 +15,7 @@
|
||||
export DOTBARE_DIR="${DOTBARE_DIR:-$HOME/.cfg/}"
|
||||
export DOTBARE_TREE="${DOTBARE_TREE:-$HOME}"
|
||||
export DOTBARE_BACKUP="${DOTBARE_BACKUP:-${XDG_DATA_HOME:-$HOME/.local/share}/dotbare}"
|
||||
export DOTBARE_VERSION="v1.1.0"
|
||||
|
||||
export EDITOR="${EDITOR:-vim}"
|
||||
if [[ -z "${DOTBARE_KEY}" ]]; then
|
||||
|
@ -32,7 +32,7 @@ function usage() {
|
||||
echo -e "optional arguments:"
|
||||
echo -e " -h, --help\t\tshow this help message and exit"
|
||||
echo -e " -u URL, --url URL\tmigrate existing dotfiles from the git URL to current system"
|
||||
echo -e " -s, --select\t\tclone submodules after checkout"
|
||||
echo -e " -s, --submodule\t\tclone submodules after checkout"
|
||||
echo -e " -y, --yes\t\tconfirm action by default and skip confirmation"
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,8 @@ cd "${mydir}/.." || exit
|
||||
echo "Updating dotbare ..."
|
||||
if git pull --rebase --stat origin master; then
|
||||
echo "dotbare updated successfully"
|
||||
dotbare_version=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
||||
printf "Current dotbare version: %s\n" "${dotbare_version}"
|
||||
else
|
||||
echo "Something went wrong, please try again or fire up a issue at https://github.com/kazhala/dotbare"
|
||||
echo "Something went wrong, please try again or fire up an issue at https://github.com/kazhala/dotbare"
|
||||
fi
|
||||
|
||||
# reset autostack to original value
|
||||
|
@ -25,6 +25,7 @@ invalid_command() {
|
||||
}
|
||||
|
||||
version() {
|
||||
source "${BATS_TEST_DIRNAME}"/../helper/set_variable.sh
|
||||
"${BATS_TEST_DIRNAME}"/../dotbare --version
|
||||
}
|
||||
|
||||
@ -35,11 +36,9 @@ version() {
|
||||
}
|
||||
|
||||
@test "main version" {
|
||||
cd "${BATS_TEST_DIRNAME}"/..
|
||||
dotbare_version="$(git describe --tags $(git rev-list --tags --max-count=1))"
|
||||
run version
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" = "Current dotbare version: ${dotbare_version}" ]]
|
||||
[[ "${output}" =~ "Current dotbare version: ${DOTBARE_VERSION}" ]]
|
||||
}
|
||||
|
||||
@test "main disable add --all" {
|
||||
|
@ -48,17 +48,17 @@ stage_modified_file() {
|
||||
@test "fadd stage selected file" {
|
||||
run stage_selected_file
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: pathspec 'searchfile' did not match any files" ]]
|
||||
[[ "${output}" =~ "fadd_stage_file" ]]
|
||||
}
|
||||
|
||||
@test "fadd stage selected dir" {
|
||||
run stage_selected_dir
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: pathspec 'searchdir' did not match any files" ]]
|
||||
[[ "${output}" =~ "fadd_stage_dir" ]]
|
||||
}
|
||||
|
||||
@test "fadd stage modified file" {
|
||||
run stage_modified_file
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: pathspec '$HOME/modifiedfile' did not match any files" ]]
|
||||
[[ "${output}" =~ "fadd_add_modified" ]]
|
||||
}
|
||||
|
@ -76,5 +76,5 @@ select_file() {
|
||||
run select_file
|
||||
[ "${status}" -eq 1 ]
|
||||
[[ "${output}" =~ 'No such file or directory' ]]
|
||||
[[ "${output}" =~ 'selectgitfile' ]]
|
||||
[[ "${output}" =~ 'fbackup_select_file' ]]
|
||||
}
|
||||
|
@ -34,30 +34,28 @@ checkout_selected_file() {
|
||||
[ "${lines[0]}" = "Usage: dotbare fcheckout [-h] [-s] [-b] [-c] [-y] ..." ]
|
||||
}
|
||||
|
||||
@test "fchekcout invalid option" {
|
||||
@test "fcheckout invalid option" {
|
||||
run invalid_option
|
||||
[ "${status}" -eq 1 ]
|
||||
[ "${lines[0]}" = "Invalid option: -p" ]
|
||||
}
|
||||
|
||||
@test "fchekcout branch" {
|
||||
@test "fcheckout branch" {
|
||||
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
|
||||
skip
|
||||
fi
|
||||
run checkout_branch
|
||||
result=$(echo "${output}" | tr '`' "'")
|
||||
[ "${status}" -eq 129 ]
|
||||
[[ "${result}" =~ "error: unknown option 'branch'" ]]
|
||||
[[ "${output}" =~ "fcheckout_branch" ]]
|
||||
}
|
||||
|
||||
@test "fchekcout commit" {
|
||||
@test "fcheckout commit" {
|
||||
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
|
||||
skip
|
||||
fi
|
||||
run checkout_commit
|
||||
result=$(echo "${lines[0]}" | tr '`' "'")
|
||||
[ "${status}" -eq 129 ]
|
||||
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
|
||||
[[ "${output}" =~ "fcheckout_commit" ]]
|
||||
}
|
||||
|
||||
@test "fcheckout modified" {
|
||||
@ -66,7 +64,7 @@ checkout_selected_file() {
|
||||
fi
|
||||
run checkout_modified_file
|
||||
[ "${status}" -eq 1 ]
|
||||
[[ "${lines[0]}" =~ "error: pathspec '$HOME/modifiedfile' did not match any file(s) known to git" ]]
|
||||
[[ "${output}" =~ "fcheckout_modified" ]]
|
||||
}
|
||||
|
||||
@test "fcheckout select" {
|
||||
@ -74,7 +72,7 @@ checkout_selected_file() {
|
||||
skip
|
||||
fi
|
||||
run checkout_selected_file
|
||||
[[ "${lines[0]}" =~ "error: pathspec 'commitdiff' did not match any file(s) known to git" ]]
|
||||
[[ "${lines[1]}" =~ "error: pathspec '$HOME/selectgitfile' did not match any file(s) known to git" ]]
|
||||
[[ "${lines[0]}" =~ "fcheckout_select_commitdiff" ]]
|
||||
[[ "${lines[1]}" =~ "fcheckout_select_gitfile" ]]
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ edit_files() {
|
||||
fi
|
||||
run edit_commits
|
||||
[ "${status}" -eq 128 ]
|
||||
[ "${lines[0]}" = "fatal: invalid upstream 'commitdiff~'" ]
|
||||
[[ "${output}" =~ "fedit_commits" ]]
|
||||
}
|
||||
|
||||
@test "fedit edit files" {
|
||||
|
@ -44,7 +44,6 @@ reset() {
|
||||
fi
|
||||
run reset
|
||||
[ "${status}" -eq 129 ]
|
||||
result=$(echo "${lines[0]}" | tr '`' "'")
|
||||
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
|
||||
[[ "${output}" =~ "usage: git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]" ]]
|
||||
[[ "${output}" =~ "flog_reset" ]]
|
||||
}
|
||||
|
@ -44,9 +44,8 @@ select_files() {
|
||||
skip
|
||||
fi
|
||||
run select_commit
|
||||
result=$(echo "${lines[0]}" | tr '`' "'")
|
||||
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
|
||||
[ "${status}" -eq 129 ]
|
||||
[[ "${output}" =~ "freset_commit" ]]
|
||||
}
|
||||
|
||||
@test "freset select files" {
|
||||
@ -55,5 +54,5 @@ select_files() {
|
||||
fi
|
||||
run select_files
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${lines[0]}" =~ "fatal: ambiguous argument '$HOME/modifiedfile': unknown revision or path not in the working tree" ]]
|
||||
[[ "${output}" =~ "freset_file" ]]
|
||||
}
|
||||
|
@ -39,17 +39,17 @@ stash_apply() {
|
||||
@test "fstash stash select file" {
|
||||
run stash_file
|
||||
[ "${status}" -eq 1 ]
|
||||
[[ "${output}" =~ "stash_select" ]]
|
||||
[[ "${output}" =~ "fstash_select" ]]
|
||||
}
|
||||
|
||||
@test "fstash stash delete" {
|
||||
run stash_delete
|
||||
[ "${status}" -eq 1 ]
|
||||
[[ "${output}" =~ "stash_delete" ]]
|
||||
[[ "${output}" =~ "fstash_delete" ]]
|
||||
}
|
||||
|
||||
@test "fstash apply stash" {
|
||||
run stash_apply
|
||||
[ "${status}" -eq 1 ]
|
||||
[[ "${output}" =~ "stash_apply" ]]
|
||||
[[ "${output}" =~ "fstash_apply" ]]
|
||||
}
|
||||
|
@ -39,17 +39,17 @@ resume_track() {
|
||||
@test "funtrack untrack file" {
|
||||
run untrack_file
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: pathspec '$HOME/selectgitfile' did not match any files" ]]
|
||||
[[ "${output}" =~ "funtrack_file" ]]
|
||||
}
|
||||
|
||||
@test "funtrack temp untrack" {
|
||||
run temp_untrack
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: Unable to mark file selectgitfile" ]]
|
||||
[[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]]
|
||||
}
|
||||
|
||||
@test "funtrack resume track" {
|
||||
run resume_track
|
||||
[ "${status}" -eq 128 ]
|
||||
[[ "${output}" =~ "fatal: Unable to mark file selectgitfile" ]]
|
||||
[[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]]
|
||||
}
|
||||
|
@ -25,10 +25,8 @@ upgrade() {
|
||||
}
|
||||
|
||||
@test "fupgrade upgrade" {
|
||||
dotbare_version="$(git describe --tags $(git rev-list --tags --max-count=1))"
|
||||
skip
|
||||
run upgrade
|
||||
[ "${status}" -eq 0 ]
|
||||
[ "${lines[0]}" = "Updating dotbare ..." ]
|
||||
[[ "${output}" =~ "dotbare updated successfully" ]]
|
||||
[[ "${output}" =~ "Current dotbare version: ${dotbare_version}" ]]
|
||||
}
|
||||
|
36
tests/fzf
36
tests/fzf
@ -19,59 +19,59 @@
|
||||
|
||||
if [[ "$*" =~ "--header=select a commit to checkout" ]] && [[ "$*" =~ "show --color" ]]; then
|
||||
# dotbare fcheckout --c -- "./fcheckout.bats" @test "fcheckout commit"
|
||||
echo "--commitshow"
|
||||
echo "--fcheckout_commit"
|
||||
elif [[ "$*" =~ '--no-multi --header=select the target commit for HEAD' ]] && [[ "$*" =~ "show --color" ]]; then
|
||||
# dotbare freset --commit -y -- "./freset.bats" @test "freset select commit"
|
||||
echo "--commitshow"
|
||||
echo "--freset_commit"
|
||||
elif [[ "$*" =~ "--no-multi --header=select a commit to rename" ]] && [[ "$*" =~ "show --color=always" ]]; then
|
||||
# dotbare fedit --commit -- "./fedit.bats" @test "fedit edit commits"
|
||||
echo "commitdiff"
|
||||
echo "fedit_commits"
|
||||
elif [[ "$*" =~ '--header=select a commit' ]] && [[ "$*" =~ "show --color" ]]; then
|
||||
# dotbare flog --reset -y -- "./flog.bats" @test "flog reset"
|
||||
echo "--commitshow"
|
||||
echo "--flog_reset"
|
||||
elif [[ "$*" =~ "--no-multi --header=select a branch to checkout" ]]; then
|
||||
# dotbare fcheckout --branch -- "./fcheckout.bats" @test "fcheckout branch"
|
||||
echo "--branch"
|
||||
echo "--fcheckout_branch"
|
||||
elif [[ "$*" =~ '--header=select a file to checkout' ]] && [[ "$*" =~ "cat ${DOTBARE_TREE}/{}" ]]; then
|
||||
# dotbare fcheckout --yes -s -- "./fcheckout.bats" @test "fcheckout select"
|
||||
echo "selectgitfile"
|
||||
echo "fcheckout_select_gitfile"
|
||||
elif [[ "$*" =~ '--header=select files to backup' ]] && [[ "$*" =~ "cat ${DOTBARE_TREE}/{}" ]]; then
|
||||
# dotbare fbackup --select -- "./fbackup.bats" @test "fbackup select file"
|
||||
echo "selectgitfile"
|
||||
echo "fbackup_select_file"
|
||||
elif [[ "$*" =~ "--header=select files to untrack" ]] && [[ "$*" =~ "cat ${DOTBARE_TREE}/{}" ]]; then
|
||||
# dotbare funtrack -- "./funtrack.bats" @test "funtrack untrack file"
|
||||
echo "selectgitfile"
|
||||
echo "funtrack_file"
|
||||
elif [[ "$*" =~ '--multi --preview ' ]] && [[ "$*" =~ "tree -L 1 -C --dirsfirst {}" ]]; then
|
||||
# dotbare fadd --dir -- "./fadd.bats" @test "fadd stage selected dir"
|
||||
echo "searchdir"
|
||||
echo "fadd_stage_dir"
|
||||
elif [[ "$*" =~ '--header=select the target commit' ]] && [[ "$*" =~ "diff --color" ]]; then
|
||||
# dotbare fcheckout --yes -s -- "./fcheckout.bats" @test "fcheckout select"
|
||||
echo "commitdiff"
|
||||
echo "fcheckout_select_commitdiff"
|
||||
elif [[ "$*" =~ '--multi --preview ' ]] && [[ "$*" =~ "cat {}" ]]; then
|
||||
# dotbare fadd -f -- "./fadd.bats" @test "fadd stage selected file"
|
||||
echo "searchfile"
|
||||
echo "fadd_stage_file"
|
||||
elif [[ "$*" =~ '--header=select files to add to a stash' ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
||||
# dotbare fstash -s -- "./fstash.bats" @test "fstash stash select file"
|
||||
echo "-- stash_select"
|
||||
echo "-- fstash_select"
|
||||
elif [[ "$*" =~ '--header=select stash to delete' ]] && [[ "$*" =~ "show -p __ --color=always" ]]; then
|
||||
# dotbare fstash --delete -- "./fstash.bats" @test "fstash stash delete"
|
||||
echo "stash_delete"
|
||||
echo "fstash_delete"
|
||||
elif [[ "$*" =~ '--header=select stash to apply' ]] && [[ "$*" =~ "show -p __ --color=always" ]]; then
|
||||
# dotbare fstash -- "./fstash.bats" @test "fstash apply stash"
|
||||
echo "stash_apply"
|
||||
echo "fstash_apply"
|
||||
elif [[ "$*" =~ "--header=select a file to checkout version in HEAD" ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
||||
# dotbare fcheckout -y -- "./fcheckout.bats" @test "fcheckout modified"
|
||||
echo "-- modifiedfile"
|
||||
echo "-- fcheckout_modified"
|
||||
elif [[ "$*" =~ '--header=select files to stage' ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
||||
# dotbare fadd -- "./fadd.bats" @test "fadd stage modified files"
|
||||
echo "-- modifiedfile"
|
||||
echo "-- fadd_add_modified"
|
||||
elif [[ "$*" =~ "--header=select files to unstage" ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
||||
# dotbare freset -- "./freset.bats" @test "freset select files"
|
||||
echo "-- modifiedfile"
|
||||
echo "-- freset_file"
|
||||
elif [[ "$*" =~ "--header=select tracked files to edit" ]]; then
|
||||
# dotbare fedit -- "./fedit.bats" @test "fedit edit files"
|
||||
exit
|
||||
elif [[ "$*" =~ "--no-multi --header=commit --commitshow" ]]; then
|
||||
elif [[ "$*" =~ "--no-multi --header=commit --flog_reset" ]]; then
|
||||
# dotbare flog -- "./flog.bats" @test "flog checkout routing"
|
||||
echo "exit"
|
||||
fi
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
source "${BATS_TEST_DIRNAME}"/../helper/set_variable.sh
|
||||
setup() {
|
||||
source "${BATS_TEST_DIRNAME}"/../helper/set_variable.sh
|
||||
}
|
||||
|
||||
@test "env check env var" {
|
||||
[ "${DOTBARE_DIR}" = "$HOME/.cfg/" ]
|
||||
@ -11,4 +13,5 @@ source "${BATS_TEST_DIRNAME}"/../helper/set_variable.sh
|
||||
@test "env check fzf var" {
|
||||
[ -n "${DOTBARE_KEY}" ]
|
||||
[ -n "${FZF_DEFAULT_OPTS}" ]
|
||||
[ -n "${DOTBARE_VERSION}" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user