Skip to content

Add no verify for commit #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5033280
Adding ruby-head and ruby 2.6 to Travis, removing C ext from repo (#382)
tarcinil Aug 22, 2018
fff2dd8
Add support for unshallow (#377)
singpolyma Aug 24, 2018
6fc863b
Support merge-base (#370)
Oct 2, 2018
1c38db5
Do not allow changes to ENV to leak from test to test (#403)
jcouball Feb 17, 2019
123d259
Allow consumers to point git binary via env var (#416)
Sep 20, 2019
ea5cd9e
Add no verify for commit
AgoraSecurity Nov 7, 2019
84a271f
Implementation and tests required to ensure that command output encod…
jcouball Dec 11, 2019
3a5d962
Fix Stalebot settings to not auto-close old issues/PRs (#433)
perlun Jan 19, 2020
750e54a
Update version for pre-release (#435)
jcouball Jan 20, 2020
7a3123f
Include version.rb, providing Git::VERSION (#436)
cyclotron3k Jan 22, 2020
4cd8352
Removed blank after method name to fix warning (#439)
jcouball Jan 23, 2020
d44b476
Update instructions for making contributions (#438)
jcouball Jan 25, 2020
e74f79c
Add James Couball to the maintainers list. (#437)
jcouball Jan 25, 2020
a639f15
Release v1.6.0 (#443)
jcouball Feb 2, 2020
3abbdf9
Fix broken link in a PR template (#444)
yuta1024 Feb 3, 2020
05dbada
fix broken link in a PR template again (#446)
yuta1024 Feb 4, 2020
703b890
Fix describe command's dirty, abbrev, candidates, and match options (…
a4z Feb 6, 2020
6c0509a
Fix issue with color escape codes after recent update of `git` binari…
mhoyer Feb 10, 2020
186ee2c
Add yard doc for changes in #commit
AgoraSecurity Feb 21, 2020
a5e7acc
Add function to move files
AgoraSecurity Feb 21, 2020
400ba63
Add unit testing for commit with option no-verify
AgoraSecurity Feb 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add unit testing for commit with option no-verify
Signed-off-by: Agora Security <github@agora-security.com>
  • Loading branch information
AgoraSecurity committed Feb 21, 2020
commit 400ba63d83c2cdd1a4008fe7fd7c76ec346f2a39
31 changes: 31 additions & 0 deletions tests/units/test_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,37 @@ def test_commit_with_date
assert_equal("Scott Chacon <schacon@gmail.com> #{author_date.strftime("%s %z")}", data['author'])
end

def test_commit_with_no_verify
# Backup current pre-commit hook
pre_commit_path = "#{@wdir}/.git/hooks/pre-commit"
pre_commit_path_bak = "#{pre_commit_path}-bak"
move_file(pre_commit_path, pre_commit_path_bak)

# Adds a pre-commit file that should throw an error
create_file(pre_commit_path, 'echo Pre-commit file. Shoud not execute; exit 1') # Error when executed
File.chmod(0111, pre_commit_path)

create_file("#{@wdir}/test_file_2", 'content test_file_2')
@lib.add('test_file_2')

# Error raised because of pre-commit hook and no use of no_verify option
assert_raise Git::GitExecuteError do
@lib.commit('commit without no verify and pre-commit file')
end

# Error is not raised when no_verify is passed
assert_nothing_raised do
@lib.commit('commit with no verify and pre-commit file', no_verify: true )
end

# Restore pre-commit hook
move_file(pre_commit_path_bak, pre_commit_path)

# Verify the commit was created
data = @lib.commit_data('HEAD')
assert_equal("commit with no verify and pre-commit file\n", data['message'])
end

def test_checkout
assert(@lib.checkout('test_checkout_b',{:new_branch=>true}))
assert(@lib.checkout('master'))
Expand Down