33# @title How To Contribute
44-->
55
6+ # Contributing to the git gem
7+
8+ * [ Summary] ( #summary )
69* [ How to contribute] ( #how-to-contribute )
710* [ How to report an issue or request a feature] ( #how-to-report-an-issue-or-request-a-feature )
811* [ How to submit a code or documentation change] ( #how-to-submit-a-code-or-documentation-change )
1922 * [ Continuous integration] ( #continuous-integration )
2023 * [ Documentation] ( #documentation )
2124* [ Licensing] ( #licensing )
25+ * [ Building a specific version of the git command-line] ( #building-a-specific-version-of-the-git-command-line )
2226
23-
24- # Contributing to the git gem
27+ ## Summary
2528
2629Thank you for your interest in contributing to the ` ruby-git ` project.
2730
@@ -172,6 +175,9 @@ $ bin/test test_object test_archive
172175
173176# run all unit tests:
174177$ bin/test
178+
179+ # run unit tests with a different version of the git command line:
180+ $ GIT_PATH=/Users/james/Downloads/git-2.30.2/bin-wrappers bin/test
175181```
176182
177183### Continuous integration
@@ -190,4 +196,58 @@ New and updated public-facing features should be documented in the project's [RE
190196
191197` ruby-git ` uses [ the MIT license] ( https://choosealicense.com/licenses/mit/ ) as declared in the [ LICENSE] ( LICENSE ) file.
192198
193- Licensing is critical to open-source projects as it ensures the software remains available under the terms desired by the author.
199+ Licensing is critical to open-source projects as it ensures the software remains available under the terms desired by the author.
200+
201+ ## Building a specific version of the git command-line
202+
203+ For testing, it is helpful to be able to build and use a specific version of the git
204+ command-line with the git gem.
205+
206+ Instructions to do this can be found on the page [ How to install
207+ Git] ( https://www.atlassian.com/git/tutorials/install-git ) from Atlassian.
208+
209+ I have successfully used the instructions in the section "Build Git from source on OS
210+ X" on MacOS 15. I have copied the following instructions from the Atlassian page.
211+
212+ 1 . From your terminal install XCode's Command Line Tools:
213+
214+ ``` shell
215+ xcode-select --install
216+ ```
217+
218+ 2 . Install [ Homebrew] ( http://brew.sh/ )
219+
220+ 3 . Using Homebrew, install openssl:
221+
222+ ``` shell
223+ brew install openssl
224+ ```
225+
226+ 4 . Download the source tarball for the desired version from
227+ [ here] ( https://mirrors.edge.kernel.org/pub/software/scm/git/ ) and extract it
228+
229+ 5 . Build Git run make with the following command:
230+
231+ ``` shell
232+ NO_GETTEXT=1 make CFLAGS=" -I/usr/local/opt/openssl/include" LDFLAGS=" -L/usr/local/opt/openssl/lib"
233+ ```
234+
235+ 6 . The newly built git command will be found at ` bin-wrappers/git `
236+
237+ 7 . Use the new git command-line version
238+
239+ Configure the git gem to use the newly built version:
240+
241+ ``` ruby
242+ require ' git'
243+ # set the binary path
244+ Git .configure { |config | config.binary_path = ' /Users/james/Downloads/git-2.30.2/bin-wrappers/git' }
245+ # validate the version
246+ assert_equal([2 , 30 , 2 ], Git .binary_version)
247+ ```
248+
249+ or run tests using the newly built version:
250+
251+ ``` shell
252+ GIT_PATH=/Users/james/Downloads/git-2.30.2/bin-wrappers bin/test
253+ ```
0 commit comments