Permalink
Browse files

Merge branch 'hotfix-1.0.2.6'

  • Loading branch information...
2 parents f7b70d9 + 1f90c47 commit 051cf779ad0c04dc49c093d82ae3445cab576aa9 @jeffWelling jeffWelling committed May 28, 2011
@@ -332,7 +332,7 @@ def init_ticgitng_branch(ticgitng_branch = false)
new_file('.hold', 'hold')
unless ticgitng_branch
- git.add
+ git.add ".hold"
git.commit('creating the ticgit-ng branch')
end
end
@@ -84,19 +84,29 @@ def self.parse_ticket_name(name)
# write this ticket to the git database
def save_new
base.in_branch do |wd|
+ files=[]
+ t=nil
base.logger.info "saving #{ticket_name}"
Dir.mkdir(ticket_name)
Dir.chdir(ticket_name) do
base.new_file('TICKET_ID', ticket_name)
+ files << File.join( ticket_name, 'TICKET_ID' )
base.new_file('TICKET_TITLE', title)
- base.new_file('ASSIGNED_' + email, email)
- base.new_file('STATE_' + state, state)
+ files << File.join( ticket_name, 'TICKET_TITLE' )
+ base.new_file( (t='ASSIGNED_'+email) , email)
+ files << File.join( ticket_name, t )
+ base.new_file( (t='STATE_'+state) , state)
+ files << File.join( ticket_name, t )
base.new_file('TITLE', title)
+ files << File.join( ticket_name, 'TITLE' )
# add initial comment
#COMMENT_080315060503045__schacon_at_gmail
- base.new_file(comment_name(email), opts[:comment]) if opts[:comment]
+ if opts[:comment]
+ base.new_file(t=comment_name(email), opts[:comment])
+ files << File.join( ticket_name, t )
+ end
# add initial tags
if opts[:tags] && opts[:tags].size > 0
@@ -106,12 +116,15 @@ def save_new
tag_filename = 'TAG_' + Ticket.clean_string(tag)
if !File.exists?(tag_filename)
base.new_file(tag_filename, tag_filename)
+ files << File.join( ticket_name, tag_filename )
end
end
end
end
end
- base.git.add
+ files.each {|file|
+ base.git.add file
+ }
base.git.commit("added ticket #{ticket_name}")
end
# ticket_id
@@ -124,24 +137,26 @@ def self.clean_string(string)
def add_comment(comment)
return false if !comment
base.in_branch do |wd|
+ t=nil
Dir.chdir(ticket_name) do
- base.new_file(comment_name(email), comment)
+ base.new_file(t=comment_name(email), comment)
end
- base.git.add
+ base.git.add File.join(ticket_name, t)
base.git.commit("added comment to ticket #{ticket_name}")
end
end
def change_state(new_state)
return false if !new_state
return false if new_state == state
+ t=nil
base.in_branch do |wd|
Dir.chdir(ticket_name) do
- base.new_file('STATE_' + new_state, new_state)
+ base.new_file(t='STATE_' + new_state, new_state)
end
base.git.remove(File.join(ticket_name,'STATE_' + state))
- base.git.add
+ base.git.add File.join(ticket_name, t)
base.git.commit("added state (#{new_state}) to ticket #{ticket_name}")
end
end
@@ -152,11 +167,12 @@ def change_assigned(new_assigned)
return false if new_assigned == old_assigned
base.in_branch do |wd|
+ t=nil
Dir.chdir(ticket_name) do
- base.new_file('ASSIGNED_' + new_assigned, new_assigned)
+ base.new_file(t='ASSIGNED_' + new_assigned, new_assigned)
end
base.git.remove(File.join(ticket_name,'ASSIGNED_' + old_assigned))
- base.git.add
+ base.git.add File.join(ticket_name,t)
base.git.commit("assigned #{new_assigned} to ticket #{ticket_name}")
end
end
@@ -168,13 +184,14 @@ def change_points(new_points)
Dir.chdir(ticket_name) do
base.new_file('POINTS', new_points)
end
- base.git.add
+ base.git.add File.join(ticket_name, 'POINTS')
base.git.commit("set points to #{new_points} for ticket #{ticket_name}")
end
end
def add_tag(tag)
return false if !tag
+ files=[]
added = false
tags = tag.split(',').map { |t| t.strip }
base.in_branch do |wd|
@@ -184,13 +201,16 @@ def add_tag(tag)
tag_filename = 'TAG_' + Ticket.clean_string(add_tag)
if !File.exists?(tag_filename)
base.new_file(tag_filename, tag_filename)
+ files << File.join( ticket_name, tag_filename )
added = true
end
end
end
end
if added
- base.git.add
+ files.each {|file|
+ base.git.add file
+ }
base.git.commit("added tags (#{tag}) to ticket #{ticket_name}")
end
end
@@ -1,3 +1,3 @@
module TicGitNG
- VERSION = '1.0.2.5'
+ VERSION = '1.0.2.6'
end
View
@@ -11,6 +11,7 @@
after(:all) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end
@@ -11,6 +11,7 @@
after(:each) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end
View
@@ -0,0 +1,34 @@
+require File.dirname(__FILE__) + "/spec_helper"
+require 'pp'
+
+describe TicGitNG do
+ include TicGitNGSpecHelper
+ include TicGitNG
+
+ before(:each) do
+ @path= setup_new_git_repo
+ @orig_test_opts= test_opts
+ @ticgitng= TicGitNG.open(@path, @orig_test_opts)
+ end
+
+ after(:each) do
+ Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ end
+
+ it "Should not contaminate ticgit/ticgit-ng branch just because working dir is contaminated" do
+ Dir.chdir(File.expand_path( tmp_dir=Dir.mktmpdir('ticgit-ng-gitdir1-') )) do
+ @ticgitng.ticket_new('new ticket, clean state', :comment=>"I am the content")
+ workingdir_ticket=File.join( @ticgitng.tic_working, @ticgitng.tickets.sort[0][0] )
+ new_file( File.join(workingdir_ticket, 'fake_file'), 'I am a file that should not be commited' )
+ @ticgitng.ticket_new('another ticket', :comment=>"This commit should not add the new_file()" )
+ #@ticgitng.git.gtree(@ticgitng.which_branch?).trees.map {|dir_name| dir_name.include?('fake_file') }.size.should eq(2)
+ has_fake_file=false
+ @ticgitng.git.gtree(@ticgitng.which_branch?).trees.each {|tree| tree[1].blobs.map {|blob_name| has_fake_file=true if blob_name[0].include?('fake_file') }}
+ has_fake_file.should eq(false)
+ end
+
+ end
+
+end
View
@@ -11,6 +11,7 @@
after(:all) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end
@@ -12,6 +12,7 @@
after(:each) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end
View
@@ -11,6 +11,7 @@
after(:all) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
+ Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end

0 comments on commit 051cf77

Please sign in to comment.