aboutsummaryrefslogtreecommitdiffstats
path: root/t
AgeCommit message (Collapse)Author
2019-05-25git-branch-list: Make the branch list work in subdirectoriesTeddy Wing
When the current directory was not the Git root, the command wouldn't work. It expected to find the branch list database in the `.git` directory in the current directory. Make the program work even if the current directory is a subdirectory of the Git repository.
2018-04-19git-branch-list(drop): Fix deletion for branches with slashesTeddy Wing
Previously, if a branch name had slashes in it, the `drop` command would fail. This is because it used `sed` with `/` separators, and the unescaped slashes in the branch name would mess up sed's pattern. Change this to use grep instead of sed so we don't have to worry about escaping and special characters in branch names.
2018-04-19git-branch-list(drop): Support multiple branches with similar namesTeddy Wing
Previously if you had multiple branches with similar names, they could all be deleted when deleting a single one. For example: $ git branch-list 1 a-branch-with-suffix 2 a-branch $ git branch-list drop 2 $ git branch-list $ Change the regex used to match branches to drop to match the whole line, so we don't accidentally delete a branch when it has a positive partial match.
2018-03-21git-branch-list(drop): Add support for multiple branch argumentsTeddy Wing
Allow users to drop multiple branches in a single command. Instead of: $ git branch-list 1 $ git branch-list 3 $ git branch-list 4 you can now do: $ git branch-list 1 3 4 This makes it easier to drop a bunch of branches that you no longer need saved. drop_branch(): * No longer uses `branch_or_current_branch()`. Kept that function around because I didn't feel like touching the `save_branch()` code, and extracted the Git command to get the current branch to a new `current_branch()` function. * Used one loop to get branch names from IDs if necessary and feed these into a Bash array. A second loop just after deletes all branches in the branch array using the `sed` method from before. Didn't feel like changing the `sed` command so did it this way. That said, we're probably going to have to come back to it sooner or later because it's not going to be able to handle branch names containing slashes. main `case`: Change `drop_branch` call to pass it all command line arguments, except the 0th argument, which is the "drop" command (this is why we `shift` before calling the function). 101-drop-accepts-multiple-branch-arguments.t: Update test expectation which had an extra newline at the start of the string which isn't there in the real `git branch-list` output.
2018-03-21Add `drop` command testsTeddy Wing
2018-03-18t/: Move `$BIN` variable to moduleTeddy Wing
In order to be able to easily reuse the `$BIN` variable we created in the test for the `clear` sub-command, move it to a Perl module that can be included in other tests. Add the `t/` directory to the include path when running `prove` to ensure that `bin.pm` can be found and included. Thanks to these resources for explaining Perl modules: https://perlmaven.com/how-to-create-a-perl-module-for-code-reuse https://stackoverflow.com/questions/23899121/perl-declare-and-export-variables-from-a-module/23900384#23900384 https://stackoverflow.com/questions/17931981/what-is-isa-in-perl/17932340#17932340
2018-03-18git-branch-list: Add `clear` commandTeddy Wing
A new sub-command that clears the entire branch list. This makes it easy to remove everything when all the branches in the list are stale (e.g. everything's been merged already).
2018-03-18Add TAP test structureTeddy Wing
Copied and modified from: https://github.com/teddywing/git-hook-pre-commit-python-javascript-syntax-linter/blob/efa1909/t/001-setup.t https://github.com/teddywing/git-hook-pre-commit-python-javascript-syntax-linter/blob/f6bb0d3/t/999-teardown.t