Skip to content

Commit 7453edf

Browse files
committed
Merge branch 'commit_ignore' of github.com:AgoraSecurity/ruby-git into commit_ignore
2 parents ab70b31 + 94670d1 commit 7453edf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+948
-81
lines changed

.github/stale.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1+
# Probot: Stale
2+
# https://github.com/probot/stale
3+
14
# Number of days of inactivity before an issue becomes stale
25
daysUntilStale: 60
36

47
# Number of days of inactivity before a stale issue is closed
5-
daysUntilClose: 7
8+
# Set to false to disable. If disabled, issues still need to be closed
9+
# manually, but will remain marked as stale.
10+
daysUntilClose: false
611

712
# Issues with these labels will never be considered stale
813
exemptLabels:
914
- pinned
1015
- security
1116

1217
# Label to use when marking an issue as stale
13-
staleLabel: wontfix
18+
staleLabel: stale
1419

1520
# Comment to post when marking an issue as stale. Set to `false` to disable
1621
markComment: >
17-
This issue has been automatically marked as stale because it has not had
18-
recent activity. It will be closed if no further activity occurs. Thank you
19-
for your contributions.
22+
A friendly reminder that this issue had no activity for 60 days.
2023
2124
# Comment to post when closing a stale issue. Set to `false` to disable
2225
closeComment: false

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 1.6.0
4+
5+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.6.0
6+
7+
## 1.6.0.pre1
8+
9+
See https://github.com/ruby-git/ruby-git/releases/tag/v1.6.0.pre1
10+
311
## 1.5.0
412

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

CONTRIBUTING.md

Lines changed: 89 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,118 @@
11
# Contributing to ruby-git
22

3-
Thank you for your interest in contributing to this project.
3+
Thank you for your interest in contributing to the ruby-git project.
44

5-
These are mostly guidelines, not rules.
6-
Use your best judgment, and feel free to propose changes to this document in a pull request.
5+
This document gives the guidelines for contributing to the ruby-git project.
6+
These guidelines may not fit every situation. When contributing use your best
7+
judgement.
78

8-
#### Table Of Contents
9+
Propose changes to these guidelines with a pull request.
910

10-
[How Can I Contribute?](#how-can-i-contribute)
11-
* [Submitting Issues](#submitting-issues)
12-
* [Contribution Process](#contribution-process)
13-
* [Pull Request Requirements](#pull-request-requirements)
14-
* [Code Review Process](#code-review-process)
15-
* [Developer Certification of Origin (DCO)](#developer-certification-of-origin-dco)
11+
## How to contribute to ruby-git
1612

13+
You can contribute in two ways:
1714

18-
## How Can I Contribute?
15+
1. [Report an issue or make a feature request](#how-to-report-an-issue-or-make-a-feature-request)
16+
2. [Submit a code or documentation change](#how-to-submit-a-code-or-documentation-change)
1917

20-
### Submitting Issues
18+
## How to report an issue or make a feature request
2119

22-
We utilize **GitHub Issues** for issue tracking and contributions. You can contribute in two ways:
20+
ruby-git utilizes [GitHub Issues](https://help.github.com/en/github/managing-your-work-on-github/about-issues)
21+
for issue tracking and feature requests.
2322

24-
1. Reporting an issue or making a feature request [here](https://github.com/ruby-git/ruby-git/issues/new).
25-
2. Adding features or fixing bugs yourself and contributing your code to ruby-git.
23+
Report an issue or feature request by [creating a ruby-git Github issue](https://github.com/ruby-git/ruby-git/issues/new).
24+
Fill in the template to describe the issue or feature request the best you can.
2625

27-
### Contribution Process
26+
## How to submit a code or documentation change
2827

29-
We have a 3 step process for contributions:
28+
There is three step process for code or documentation changes:
3029

31-
1. Commit changes to a git branch in your fork. Making sure to sign-off those changes for the [Developer Certificate of Origin](#developer-certification-of-origin-dco).
32-
2. Create a GitHub Pull Request for your change, following the instructions in the pull request template.
33-
3. Perform a [Code Review](#code-review-process) with the project maintainers on the pull request.
30+
1. [Commit your changes to a fork of ruby-git](#commit-changes-to-a-fork-of-ruby-git)
31+
2. [Create a pull request](#create-a-pull-request)
32+
3. [Get your pull request reviewed](#get-your-pull-request-reviewed)
3433

35-
### Pull Request Requirements
36-
In order to ensure high quality, we require that all pull requests to this project meet these specifications:
34+
### Commit changes to a fork of ruby-git
3735

38-
1. Unit Testing: We require all the new code to include unit tests, and any fixes to pass previous units.
39-
2. Green CI Tests: We are using [Travis CI](https://travis-ci.org/ruby-git/ruby-git) to run unit tests on various ruby versions, we expect them to all pass before a pull request will be merged.
40-
3. Up-to-date Documentation: New methods as well as updated methods should have [YARD](https://yardoc.org/) documentation added to them
36+
Make your changes in a fork of the ruby-git repository.
4137

42-
### Code Review Process
38+
Each commit must include a [DCO sign-off](#developer-certificate-of-origin-dco)
39+
by adding the line `Signed-off-by: Name <email>` to the end of the commit
40+
message.
4341

44-
Code review takes place in GitHub pull requests. See [this article](https://help.github.com/articles/about-pull-requests/) if you're not familiar with GitHub Pull Requests.
42+
### Create a pull request
4543

46-
Once you open a pull request, project maintainers will review your code and respond to your pull request with any feedback they might have.
44+
See [this article](https://help.github.com/articles/about-pull-requests/) if you
45+
are not familiar with GitHub Pull Requests.
4746

48-
The process at this point is as follows:
47+
Follow the instructions in the pull request template.
4948

50-
1. One thumbs-up (:+1:) is required from project maintainers. See the master maintainers document for the ruby-git project at <https://github.com/ruby-git/ruby-git/blob/master/MAINTAINERS.md>.
51-
2. When ready, your pull request will be merged into `master`, we may require you to rebase your PR to the latest `master`.
49+
### Get your pull request reviewed
5250

53-
### Developer Certification of Origin (DCO)
51+
Code review takes place in a GitHub pull request using the [the Github pull request review feature](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews).
5452

55-
Licensing is very important to open source projects. It helps ensure the software continues to be available under the terms that the author desired.
53+
Once your pull request is ready for review, request a review from at least one
54+
[maintainer](MAINTAINERS.md) and any number of other contributors.
5655

57-
ruby-git uses [the MIT license](https://github.com/ruby-git/ruby-git/blob/master/LICENSE)
56+
During the review process, you may need to make additional commits which would
57+
need to be squashed. It may also be necessary to rebase to master again if other
58+
changes are merged before your PR.
5859

59-
Detail about the LICENSE can be found [here](https://choosealicense.com/licenses/mit/)
60+
At least one approval is required from a project maintainer before your pull
61+
request can be merged. The maintainer is responsible for ensuring that the pull
62+
request meets [the project's coding standards](#coding-standards).
6063

61-
To make a good faith effort to ensure these criteria are met, ruby-git requires the Developer Certificate of Origin (DCO) process to be followed.
64+
## Coding standards
6265

63-
The DCO is an attestation attached to every contribution made by every developer.
66+
In order to ensure high quality, all pull requests must meet these requirements:
6467

65-
In the commit message of the contribution, the developer simply adds a Signed-off-by statement and thereby agrees to the DCO, which you can find below or at <http://developercertificate.org/>.
68+
### 1 PR = 1 Commit
69+
* All commits for a PR must be squashed into one commit
70+
* To avoid an extra merge commit, the PR must be able to be merged as [a fast forward merge](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
71+
* The easiest way to ensure a fast forward merge is to rebase your local branch
72+
to the ruby-git master branch
73+
74+
### Unit tests
75+
* All changes must be accompanied by new or modified unit tests
76+
* The entire test suite must pass when `bundle exec rake test` is run from the
77+
project's local working copy
78+
79+
### Continuous Integration
80+
* All tests must pass in the project's [Travis CI](https://travis-ci.org/ruby-git/ruby-git)
81+
build before the pull request will be merged
82+
83+
### Documentation
84+
* New and updated public methods must have [YARD](https://yardoc.org/)
85+
documentation added to them
86+
* New and updated public facing features should be documented in the project's
87+
[README.md](README.md)
88+
89+
### Licensing sign-off
90+
* Each commit must contain [the DCO sign-off](#developer-certificate-of-origin-dco)
91+
in the form: `Signed-off-by: Name <email>`
92+
93+
## Licensing
94+
95+
ruby-git uses [the MIT license](https://choosealicense.com/licenses/mit/) as
96+
declared in the [LICENSE](LICENSE) file.
97+
98+
Licensing is very important to open source projects. It helps ensure the
99+
software continues to be available under the terms that the author desired.
100+
101+
### Developer Certificate of Origin (DCO)
102+
103+
This project requires that authors have permission to submit their contributions
104+
under the MIT license. To make a good faith effort to ensure this, ruby-git
105+
requires the [Developer Certificate of Origin (DCO)](https://elinux.org/Developer_Certificate_Of_Origin)
106+
process be followed.
107+
108+
This process requires that each commit include a `Signed-off-by` line that
109+
indicates the author accepts the DCO. Here is an example DCO sign-off line:
110+
111+
```
112+
Signed-off-by: John Doe <john.doe@hisdomain.com>
113+
```
114+
115+
The full text of the DCO version 1.1 is below or at <http://developercertificate.org/>.
66116

67117
```
68118
Developer's Certificate of Origin 1.1
@@ -75,7 +125,7 @@ By making a contribution to this project, I certify that:
75125
76126
(b) The contribution is based upon previous work that, to the
77127
best of my knowledge, is covered under an appropriate open
78-
source license and I have the right under that license to
128+
source license and I have the right under that license to
79129
submit that work with modifications, whether created in whole
80130
or in part by me, under the same open source license (unless
81131
I am permitted to submit under a different license), as

MAINTAINERS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Maintainers
22

3-
When making changes to the system, this file tells you who needs to review your patch - you need at least two maintainers to provide a :+1: on your pull request.
3+
When making changes in this repository, one of the maintainers below must review and approve your pull request.
44

55
### Maintainers
66

77
* [Per Lundberg](https://github.com/perlun)
8-
* [Vern Burton](https://github.com/tarcinil)
8+
* [Vern Burton](https://github.com/tarcinil)
9+
* [James Couball](https://github.com/jcouball)

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Your checklist for this pull request
2-
🚨Please review the [guidelines for contributing](../CONTRIBUTING.md) to this repository.
2+
🚨Please review the [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/master/CONTRIBUTING.md) to this repository.
33

44
- [ ] Ensure all commits include DCO sign-off.
55
- [ ] Ensure that your contributions pass unit testing.

RELEASING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# How to release a new git.gem
2+
3+
Releasing a new version of the `git` gem requires these steps:
4+
* [Prepare the release](#prepare-the-release)
5+
* [Create a GitHub release](#create-a-github-release)
6+
* [Build and release the gem](#build-and-release-the-gem)
7+
8+
These instructions use an example where the current release version is `1.5.0`
9+
and the new release version to be created is `1.6.0.pre1`.
10+
11+
## Prepare the release
12+
13+
From a fork of ruby-git, create a PR containing changes to (1) bump the
14+
version number, (2) update the CHANGELOG.md, and (3) tag the release.
15+
16+
* Bump the version number in lib/git/version.rb following [Semantic Versioning](https://semver.org)
17+
guidelines
18+
* Add a link in CHANGELOG.md to the release tag which will be created later
19+
in this guide
20+
* Create a new tag using [git-extras](https://github.com/tj/git-extras/blob/master/Commands.md#git-release)
21+
`git release` command
22+
* For example: `git release v1.6.0.pre1`
23+
* These should be the only changes in the PR
24+
* 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)
25+
* Get the PR reviewed, approved and merged to master.
26+
27+
## Create a GitHub release
28+
29+
On [the ruby-git releases page](https://github.com/ruby-git/ruby-git/releases),
30+
select `Draft a new release`
31+
32+
* Select the tag corresponding to the version being released `v1.6.0.pre1`
33+
* The Target should be `master`
34+
* For the release description, use the output of [changelog-rs](https://github.com/perlun/changelog-rs)
35+
* Since the release has not been created yet, you will need to supply
36+
`changeling-rs` with the current release tag and the tag the new release
37+
is being created from
38+
* For example: `changelog-rs . v1.5.0 v1.6.0.pre1`
39+
* Copy the output, omitting the tag header `## v1.6.0.pre1` and paste into
40+
the release description
41+
* The release description can be edited later if needed
42+
* Select the appropriate value for `This is a pre-release`
43+
* Since `v1.6.0.pre1` is a pre-release, check `This is a pre-release`
44+
45+
## Build and release the gem
46+
47+
Clone [ruby-git/ruby-git](https://github.com/ruby-git/ruby-git) directly (not a
48+
fork) and ensure your local working copy is on the master branch
49+
50+
* Verify that you are not on a fork with the command `git remote -v`
51+
* Verify that the version number is correct by running `rake -T` and inspecting
52+
the output for the `release[remote]` task
53+
54+
Build the git gem and push it to rubygems.org with the command `rake release`
55+
56+
* Ensure that your `gem sources list` includes `https://rubygems.org` (in my
57+
case, I usually have my work’s internal gem repository listed)

git.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Gem::Specification.new do |s|
1515
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
1616
s.requirements = ['git 1.6.0.0, or greater']
1717

18+
s.add_runtime_dependency 'rchardet', '~> 1.8'
19+
1820
s.add_development_dependency 'rake'
1921
s.add_development_dependency 'rdoc'
2022
s.add_development_dependency 'test-unit', '>=2', '< 4'

lib/git.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
require 'git/status'
2020
require 'git/stash'
2121
require 'git/stashes'
22+
require 'git/version'
2223
require 'git/working_directory'
2324

2425
lib = Git::Lib.new(nil, nil)
@@ -34,15 +35,15 @@
3435
# and more. You should be able to do most fundamental git
3536
# operations with this library.
3637
#
37-
# This module provides the basic functions to open a git
38+
# This module provides the basic functions to open a git
3839
# reference to work with. You can open a working directory,
3940
# open a bare repository, initialize a new repo or clone an
4041
# existing remote repository.
4142
#
4243
# Author:: Scott Chacon (mailto:schacon@gmail.com)
4344
# License:: MIT License
4445
module Git
45-
46+
4647
#g.config('user.name', 'Scott Chacon') # sets value
4748
#g.config('user.email', 'email@email.com') # sets value
4849
#g.config('user.name') # returns 'Scott Chacon'
@@ -82,7 +83,7 @@ def global_config(name = nil, value = nil)
8283
def self.bare(git_dir, options = {})
8384
Base.bare(git_dir, options)
8485
end
85-
86+
8687
# clones a remote repository
8788
#
8889
# options
@@ -110,7 +111,7 @@ def self.export(repository, name, options = {})
110111
repo.checkout("origin/#{options[:branch]}") if options[:branch]
111112
Dir.chdir(repo.dir.to_s) { FileUtils.rm_r '.git' }
112113
end
113-
114+
114115
# Same as g.config, but forces it to be at the global level
115116
#
116117
#g.config('user.name', 'Scott Chacon') # sets value
@@ -139,8 +140,8 @@ def self.global_config(name = nil, value = nil)
139140
def self.init(working_dir = '.', options = {})
140141
Base.init(working_dir, options)
141142
end
142-
143-
# returns a Hash containing information about the references
143+
144+
# returns a Hash containing information about the references
144145
# of the target repository
145146
#
146147
# @param [String|NilClass] location the target repository location or nil for '.'
@@ -150,7 +151,7 @@ def self.ls_remote(location=nil)
150151
end
151152

152153
# open an existing git working directory
153-
#
154+
#
154155
# this will most likely be the most common way to create
155156
# a git reference, referring to a working directory.
156157
# if not provided in the options, the library will assume
@@ -162,5 +163,5 @@ def self.ls_remote(location=nil)
162163
def self.open(working_dir, options = {})
163164
Base.open(working_dir, options)
164165
end
165-
166+
166167
end

lib/git/branch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def archive(file, opts = {})
3737
# # do other stuff
3838
# return true # auto commits and switches back
3939
# end
40-
def in_branch (message = 'in branch work')
40+
def in_branch(message = 'in branch work')
4141
old_current = @base.lib.branch_current
4242
checkout
4343
if yield

lib/git/diff.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@ def process_full_diff
127127
}
128128
final = {}
129129
current_file = nil
130-
if @full_diff.encoding.name != "UTF-8"
131-
full_diff_utf8_encoded = @full_diff.encode("UTF-8", "binary", { :invalid => :replace, :undef => :replace })
132-
else
133-
full_diff_utf8_encoded = @full_diff
134-
end
135-
full_diff_utf8_encoded.split("\n").each do |line|
130+
@full_diff.split("\n").each do |line|
136131
if m = /^diff --git a\/(.*?) b\/(.*?)/.match(line)
137132
current_file = m[1]
138133
final[current_file] = defaults.merge({:patch => line, :path => current_file})

0 commit comments

Comments
 (0)