Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Allowing GPG signing of Git tags #653

Merged
merged 1 commit into from
Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions lib/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,9 @@ module.exports =
type: "boolean"
default: false
description: "Show notifications while running `fetch --all`?"
signTags:
order: 7
title: "Sign git tags with GPG"
type: "boolean"
default: false
description: "Use a GPG key to sign Git tags"
3 changes: 2 additions & 1 deletion lib/views/tag-create-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class TagCreateView extends View

createTag: ->
tag = name: @tagName.getModel().getText(), message: @tagMessage.getModel().getText()
git.cmd(['tag', '-a', tag.name, '-m', tag.message], cwd: @repo.getWorkingDirectory())
flag = if atom.config.get('git-plus.experimental.signTags') then '-s' else '-a'
git.cmd(['tag', flag, tag.name, '-m', tag.message], cwd: @repo.getWorkingDirectory())
.then (success) ->
notifier.addSuccess("Tag '#{tag.name}' has been created successfully!") if success
.catch (msg) ->
Expand Down
9 changes: 9 additions & 0 deletions spec/views/tag-create-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ describe "TagCreateView", ->
@view.tagMessage.setText 'tag1 message'
@view.find('.gp-confirm-button').click()
expect(git.cmd).toHaveBeenCalledWith ['tag', '-a', 'tag1', '-m', 'tag1 message'], {cwd}

it "creates a signed tag with the given name and message", ->
atom.config.set('git-plus.experimental.signTags', true)
spyOn(git, 'cmd').andReturn Promise.resolve 0
cwd = repo.getWorkingDirectory()
@view.tagName.setText 'tag2'
@view.tagMessage.setText 'tag2 message'
@view.find('.gp-confirm-button').click()
expect(git.cmd).toHaveBeenCalledWith ['tag', '-s', 'tag2', '-m', 'tag2 message'], {cwd}