aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-02-21git-branch-list: Add a flag to output the program versionTeddy Wing
2018-02-21Add Bash completionTeddy Wing
Used https://github.com/git/git/blob/7cc763aaa3f39c62e0b2d5520e9d2bd8e4f3c4b3/contrib/completion/git-completion.bash as a reference. Learned how to set up completion for a custom subcommand from: https://github.com/bobthecow/git-flow-completion/blob/4180a3a0e1b286d5f35fefbea5adf5ce9875ecc3/git-flow-completion.bash
2018-02-21git-branch-list(is_a_branch): Remove `$?` from `return`Teddy Wing
I had forgotten when I wrote this, but the Bash help says: > If N is omitted, the return status is that of the last command. Meaning we don't need to explicitly return the code from the last command as that's what happens by default.
2018-02-21git-branch-list: Update usage to include optional `<branch-name>`Teddy Wing
The `save` and `drop` commands both take an optional branch name to operate on.
2018-02-21Add license (GNU GPLv3+)Teddy Wing
And include a header comment containing a short description of the program.
2018-02-21git-branch-list: Add usage outputTeddy Wing
Not using `--help` because Git uses this flag to open a `man` page for the subcommand, and I don't have a `man` page.
2018-02-20git-branch-list: Remove obsolete commentsTeddy Wing
Some ideas or old versions of code that is no longer relevant. I've also decided not to implement the TODO and have the list IDs change when you change the list like in `git stash`, at least for now. I'll keep the TODO in mind when I use the program and reevaluate to see whether it makes sense to have fixed IDs.
2018-02-20git-branch-list(drop_branch): Remove `sed` backup fileTeddy Wing
We don't really care about this backup file, so once the `sed` operation is finished, remove it.
2018-02-20git-branch-list(is_a_branch): Quiet `git rev-parse`Teddy Wing
We only care about the return code here. If `git rev-parse --verify` is successful or if it fails to find a branch with the given name, it will write output. We don't want this output to be printed, so send it to `/dev/null`.
2018-02-20git-branch-list(drop_branch): Allow dropping branches by IDTeddy Wing
In addition to letting you drop the current branch and a parameter with the name of the branch, allow branches to be dropped by their ID if they don't match an existing branch. Extract the code that finds a branch in the database by its ID to a function so it can be used by both the `checkout_branch` and `drop_branch` functions.
2018-02-20git-branch-list(checkout_branch): Error if ID is invalidTeddy Wing
If the given ID doesn't correspond to a branch in our database, we should exit with an error.
2018-02-20git-branch-list: Verify ID is an integer before doing `checkout`Teddy Wing
When running: $ git branch-list 2 we want to ensure the argument "2" in the example above is an integer. If so, we take it to represent a branch-list ID. Otherwise an error code should be returned. Thanks to Peter Ho on StackOverflow for the neat Bash integer test: https://stackoverflow.com/questions/2210349/bash-test-whether-string-is-valid-as-an-integer/19116862#19116862
2018-02-20git-branch-list(save_branch): Don't add branch if already savedTeddy Wing
Don't add existing branches to the database. We don't want any duplicate branch names cluttering the shortcut list.
2018-02-20Add initial draft of `git-branch-list`Teddy Wing
A Git add-on that stores a list of branch names and allows you to quickly switch to any branch in the list. This enables you to more quickly switch between branches that you're working on or reviewing without having to either remember or look up the beginnings of the names of the branches. Currently provides basic functionality for saving and dropping branches from the list, printing the list, and checking out a branch in the list. The branch list "database" is stored in a text file in the `.git/info/` directory local to the project. Perhaps worrisome to store an external file in the internal Git directory, but this allows us to keep the database local to the current project and maintain different databases for different projects.