Skip to content

Commit

Permalink
Merge remote-tracking branches 'p/diff-submodule' and 'p/set-url-push…
Browse files Browse the repository at this point in the history
…' into mine

* p/diff-submodule: (36 commits)
  Support --submodule option to git diff.
  Support the --all option for git fetch (ruby-git#583)
  Workaround to get JRuby build working (ruby-git#582)
  Update README.md (ruby-git#580)
  Make the directory param to Git.clone optional (ruby-git#578)
  Make Git::URL.clone_to handle cloning to bare and mirror repos (ruby-git#577)
  Add Git::URL #parse and #clone_to methods (ruby-git#575)
  Use the head version of yard (ruby-git#573)
  Release v1.11.0
  Supress unneeded test output (ruby-git#570)
  Add support for fetch options "--force/-f" and "--prune-tags/-P". (ruby-git#563)
  Fix bug when grepping lines that contain numbers surrounded by colons (ruby-git#566)
  remove from maintainer (ruby-git#567)
  Address command line injection in Git::Lib#fetch
  Release v1.10.2 (ruby-git#561)
  Add create-release, setup, and console dev scripts (ruby-git#560)
  Store tempfile objects to prevent deletion during tests (ruby-git#555)
  Release v1.10.1 (ruby-git#553)
  Properly escape double quotes in shell commands on Windows (ruby-git#552)
  Properly unescape diff paths (ruby-git#504)
  ...

* p/set-url-push: (36 commits)
  Add :push option to remote_set_url.
  Support the --all option for git fetch (ruby-git#583)
  Workaround to get JRuby build working (ruby-git#582)
  Update README.md (ruby-git#580)
  Make the directory param to Git.clone optional (ruby-git#578)
  Make Git::URL.clone_to handle cloning to bare and mirror repos (ruby-git#577)
  Add Git::URL #parse and #clone_to methods (ruby-git#575)
  Use the head version of yard (ruby-git#573)
  Release v1.11.0
  Supress unneeded test output (ruby-git#570)
  Add support for fetch options "--force/-f" and "--prune-tags/-P". (ruby-git#563)
  Fix bug when grepping lines that contain numbers surrounded by colons (ruby-git#566)
  remove from maintainer (ruby-git#567)
  Address command line injection in Git::Lib#fetch
  Release v1.10.2 (ruby-git#561)
  Add create-release, setup, and console dev scripts (ruby-git#560)
  Store tempfile objects to prevent deletion during tests (ruby-git#555)
  Release v1.10.1 (ruby-git#553)
  Properly escape double quotes in shell commands on Windows (ruby-git#552)
  Properly unescape diff paths (ruby-git#504)
  ...
  • Loading branch information
p committed May 27, 2022
3 parents f52df6d + bc0d2d1 + 2fea684 commit 1955944
Show file tree
Hide file tree
Showing 51 changed files with 1,737 additions and 202 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/continuous_integration.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [2.3, 2.7]
ruby: [2.3, 2.7, 3.0]
operating-system: [ubuntu-latest]
include:
- ruby: head
Expand All @@ -28,6 +28,9 @@ jobs:

runs-on: ${{ matrix.operating-system }}

env:
JAVA_OPTS: -Djdk.io.File.enableADS=true

steps:
- name: Checkout Code
uses: actions/checkout@v2
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,37 @@

# Change Log

## v1.11.0

* 292087e Supress unneeded test output (#570)
* 19dfe5e Add support for fetch options "--force/-f" and "--prune-tags/-P". (#563)
* 018d919 Fix bug when grepping lines that contain numbers surrounded by colons (#566)
* c04d16e remove from maintainer (#567)
* 291ca09 Address command line injection in Git::Lib#fetch
* 521b8e7 Release v1.10.2 (#561)

See https://github.com/ruby-git/ruby-git/releases/tag/v1.11.0

## v1.10.2

See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.2

## 1.10.1

See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.1

## 1.10.0

See https://github.com/ruby-git/ruby-git/releases/tag/v1.10.0

## 1.9.1

See https://github.com/ruby-git/ruby-git/releases/tag/v1.9.1

## 1.9.0

See https://github.com/ruby-git/ruby-git/releases/tag/v1.9.0

## 1.8.1

See https://github.com/ruby-git/ruby-git/releases/tag/v1.8.1
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile.changelog-rs
@@ -0,0 +1,12 @@
FROM rust

# Build the docker image (from this project's root directory):
# docker build --file Dockerfile.changelog-rs --tag changelog-rs .
#
# Use this image to output a changelog (from this project's root directory):
# docker run --rm --volume "$PWD:/worktree" changelog-rs v1.9.1 v1.10.0

RUN cargo install changelog-rs
WORKDIR /worktree

ENTRYPOINT ["/usr/local/cargo/bin/changelog-rs", "/worktree"]
7 changes: 6 additions & 1 deletion Gemfile
@@ -1,4 +1,9 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec :name => 'git'
git 'https://github.com/lsegal/yard', branch: 'main' do
gem 'yard'
end

gemspec name: 'git'
1 change: 0 additions & 1 deletion MAINTAINERS.md
Expand Up @@ -10,5 +10,4 @@ When making changes in this repository, one of the maintainers below must review
### Maintainers

* [Per Lundberg](https://github.com/perlun)
* [Vern Burton](https://github.com/tarcinil)
* [James Couball](https://github.com/jcouball)
26 changes: 23 additions & 3 deletions README.md
Expand Up @@ -108,7 +108,7 @@ g.index.writable?
g.repo
g.dir

g.log # returns array of Git::Commit objects
g.log # returns a Git::Log object, which is an Enumerator of Git::Commit objects
g.log.since('2 weeks ago')
g.log.between('v2.5', 'v2.6')
g.log.each {|l| puts l.sha }
Expand Down Expand Up @@ -146,6 +146,7 @@ g.revparse('v2.5:Makefile')

g.branches # returns Git::Branch objects
g.branches.local
g.current_branch
g.branches.remote
g.branches[:master].gcommit
g.branches['origin/master'].gcommit
Expand Down Expand Up @@ -203,13 +204,23 @@ g = Git.init
{ :repository => '/opt/git/proj.git',
:index => '/tmp/index'} )

g = Git.clone(URI, NAME, :path => '/tmp/checkout')
# Clone from a git url
git_url = 'https://github.com/ruby-git/ruby-git.git'
# Clone into the ruby-git directory
g = Git.clone(git_url)

# Clone into /tmp/clone/ruby-git-clean
name = 'ruby-git-clean'
path = '/tmp/clone'
g = Git.clone(git_url, name, :path => path)
g.dir #=> /tmp/clone/ruby-git-clean

g.config('user.name', 'Scott Chacon')
g.config('user.email', 'email@email.com')

# Clone can take an optional logger
logger = Logger.new
g = Git.clone(URI, NAME, :log => logger)
g = Git.clone(git_url, NAME, :log => logger)

g.add # git add -- "."
g.add(:all=>true) # git add --all -- "."
Expand All @@ -225,6 +236,14 @@ g.remove('file.txt', :cached => true) # git rm -f --cached -- "file.txt"
g.commit('message')
g.commit_all('message')

# Sign a commit using the gpg key configured in the user.signingkey config setting
g.config('user.signingkey', '0A46826A')
g.commit('message', gpg_sign: true)

# Sign a commit using a specified gpg key
key_id = '0A46826A'
g.commit('message', gpg_sign: key_id)

g = Git.clone(repo, 'myrepo')
g.chdir do
new_file('test-file', 'blahblahblah')
Expand Down Expand Up @@ -269,6 +288,7 @@ g.remote(name).merge(branch)
g.fetch
g.fetch(g.remotes.first)
g.fetch('origin', {:ref => 'some/ref/head'} )
g.fetch(all: true, force: true, depth: 2)

g.pull
g.pull(Git::Repo, Git::Branch) # fetch and a merge
Expand Down
66 changes: 36 additions & 30 deletions RELEASING.md
Expand Up @@ -6,9 +6,11 @@
# How to release a new git.gem

Releasing a new version of the `git` gem requires these steps:
* [Prepare the release](#prepare-the-release)
* [Create a GitHub release](#create-a-github-release)
* [Build and release the gem](#build-and-release-the-gem)

- [How to release a new git.gem](#how-to-release-a-new-gitgem)
- [Prepare the release](#prepare-the-release)
- [Create a GitHub release](#create-a-github-release)
- [Build and release the gem](#build-and-release-the-gem)

These instructions use an example where the current release version is `1.5.0`
and the new release version to be created is `1.6.0.pre1`.
Expand All @@ -18,45 +20,49 @@ and the new release version to be created is `1.6.0.pre1`.
From a fork of ruby-git, create a PR containing changes to (1) bump the
version number, (2) update the CHANGELOG.md, and (3) tag the release.

* Bump the version number in lib/git/version.rb following [Semantic Versioning](https://semver.org)
guidelines
* Add a link in CHANGELOG.md to the release tag which will be created later
in this guide
* Create a new tag using [git-extras](https://github.com/tj/git-extras/blob/master/Commands.md#git-release)
`git release` command
* For example: `git release v1.6.0.pre1`
* These should be the only changes in the PR
* An example of these changes for `v1.6.0.pre1` can be found in [PR #435](https://github.com/ruby-git/ruby-git/pull/435)
* Get the PR reviewed, approved and merged to master.
- Bump the version number in lib/git/version.rb following [Semantic Versioning](https://semver.org)
guidelines
- Add a link in CHANGELOG.md to the release tag which will be created later
in this guide
- Create a new tag using [git-extras](https://github.com/tj/git-extras/blob/master/Commands.md#git-release)
`git release` command
- For example: `git release v1.6.0.pre1`
- These should be the only changes in the PR
- An example of these changes for `v1.6.0.pre1` can be found in [PR #435](https://github.com/ruby-git/ruby-git/pull/435)
- Get the PR reviewed, approved and merged to master.

## Create a GitHub release

On [the ruby-git releases page](https://github.com/ruby-git/ruby-git/releases),
select `Draft a new release`

* Select the tag corresponding to the version being released `v1.6.0.pre1`
* The Target should be `master`
* For the release description, use the output of [changelog-rs](https://github.com/perlun/changelog-rs)
* Since the release has not been created yet, you will need to supply
`changeling-rs` with the current release tag and the tag the new release
is being created from
* For example: `changelog-rs . v1.5.0 v1.6.0.pre1`
* Copy the output, omitting the tag header `## v1.6.0.pre1` and paste into
the release description
* The release description can be edited later if needed
* Select the appropriate value for `This is a pre-release`
* Since `v1.6.0.pre1` is a pre-release, check `This is a pre-release`
- Select the tag corresponding to the version being released `v1.6.0.pre1`
- The Target should be `master`
- For the release description, use the output of [changelog-rs](https://github.com/perlun/changelog-rs)
- A Docker image is provided in [Dockerfile.changelog-rs](https://github.com/ruby-git/ruby-git/blob/master/Dockerfile.changelog-rs)
so you don't have to install changelog-rs or the Rust tool chain. To build the
Docker image, run this command from this project's root directory:
- `docker build --file Dockerfile.changelog-rs --tag changelog-rs .`
- To run the changelog-rs command using this image, run the following command
from this project's root directory (replace the tag names appropriate for the
current release):
- `docker run --rm --volume "$PWD:/worktree" changelog-rs v1.5.0 v1.6.0.pre1`
- Copy the output, omitting the tag header `## v1.6.0.pre1` and paste into
the release description
- The release description can be edited later if needed
- Select the appropriate value for `This is a pre-release`
- Since `v1.6.0.pre1` is a pre-release, check `This is a pre-release`

## Build and release the gem

Clone [ruby-git/ruby-git](https://github.com/ruby-git/ruby-git) directly (not a
fork) and ensure your local working copy is on the master branch

* Verify that you are not on a fork with the command `git remote -v`
* Verify that the version number is correct by running `rake -T` and inspecting
the output for the `release[remote]` task
- Verify that you are not on a fork with the command `git remote -v`
- Verify that the version number is correct by running `rake -T` and inspecting
the output for the `release[remote]` task

Build the git gem and push it to rubygems.org with the command `rake release`

* Ensure that your `gem sources list` includes `https://rubygems.org` (in my
case, I usually have my work’s internal gem repository listed)
- Ensure that your `gem sources list` includes `https://rubygems.org` (in my
case, I usually have my work’s internal gem repository listed)
15 changes: 15 additions & 0 deletions bin/console
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'git'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require 'irb'
IRB.start(__FILE__)

0 comments on commit 1955944

Please sign in to comment.