We love pull requests from everyone. By participating in this project, you agree to abide by the thoughtbot code of conduct.
Here's a quick guide to begin contributing:
-
Clone the repo:
git clone https://github.com/thoughtbot/gitsh.git
-
Ensure GNU Readline and GNU Autotools are installed, e.g. on macOS you would run:
brew install readline brew install automake
-
Build the generated files. Some Ruby files in
gitsh
are generated by the build system, and the tests won't run without them:cd gitsh ./autogen.sh bundle RUBY=$(which ruby) ./configure make
Note that setting
RUBY=$(which ruby)
will use your current Ruby version. This isn't recommended for installing gitsh for day-to-day use, but is recommended for development.The
./configure
step will search for GNU Readline, but might fail if GNU Readline isn't installed on your system, or if it finds an incompatible implementation first. If this happens, you can set theCPPFLAGS
andLDFLAGS
environment variables to tell gitsh where to find Readline. For example, on macOS with Readline installed via Homebrew, you will need something like this:RUBY=$(which ruby) CPPFLAGS='-I/usr/local/opt/readline/include' \ LDFLAGS='-L/usr/local/opt/readline/lib' ./configure
-
Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
make check
-
Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test!
-
Make the test pass.
-
Fork the repo, push to your fork, and submit a pull request.
At this point you're waiting on us. We like to at least comment on, if not accept, pull requests within three business days. We may suggest some changes or improvements or alternatives.
Some things that will increase the chance that your pull request is accepted:
- Include tests that fail without your code, and pass with it.
- Update the documentation, especially the man page, whatever is affected by your contribution.
- Follow the thoughtbot style guide.
And in case we didn't emphasize it enough: we love tests!
We use the autotools structure for running tests. To run the full suite,
use the check
target:
make check
You can run a subset of the tests by file name:
env TESTS="spec/integration/tab_completion_spec" make -e check
The full test output is available in test-suite.log
, and partial
output is available in the log for the test itself (e.g.
spec/integration/arguments_spec.log
).
To run your cloned version of gitsh locally, simply run:
./bin/gitsh
gitsh is packaged and installed using GNU autotools.
-
Make sure you're starting from a clean slate:
make distclean git checkout master
-
Update the version number in
configure.ac
. -
Update the
configure
script,Makefile
, and other dependencies:./autogen.sh ./configure
-
Commit your changes to
configure.ac
,INSTALL
, and any other files that were modified by the version bump:git add . git commit -m "Bump version: X.Y.Z" git push
-
Build and publish the release:
make release_build make release_push make release_clean
Alternatively, you can use a single command that will run them for you. If anything goes wrong, this will be harder to debug:
make release
When a new version of Ruby is released, or an old version of Ruby reaches end-of-life, we should update gitsh's requirements to match.
- Update the build system (
configure.ac
):- Change the
AX_PROG_RUBY_VERSION
call to the minimum supported version. - Change the list of possible binary names passed to
AC_PATH_PROGS
to reflect the supported versions, e.g. if Ruby 2.6 is supported, thenruby26
should be included in the list.
- Change the
- Update the CI configuration in
.travis.yml
. - Update references to the minimum supported version in the documentation:
- Update the install instructions template in
INSTALL.in
. - Update the generated
INSTALL
instructions (./configure && make
).
- Update the install instructions template in
- Update the Ruby dependency in package manager templates to the minimum
supported version:
homebrew/gitsh.rb.in
arch/PKGBUILD.in
Gems can be updated in the usual way:
bundle update
When updating Rubygems for gitsh, there are a few things to consider:
- The Gemfile is only used by developers and maintainers. When gitsh is distributed, all of the gems' files are included in the distribution.
- Use the minimum supported Ruby version when updating gems to avoid installing versions that are incompatible with older Rubies.