TicGit-ng 1.0.2.15 → 1.0.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,11 +37,17 @@ module TicGitNG
37
37
 
38
38
  proj = Ticket.clean_string(@git.dir.path)
39
39
 
40
- @tic_dir = opts[:tic_dir] || "~/.#{which_branch?}"
40
+ #Use this hack instead of git itself because this is ridiculously faster then
41
+ #getting the same information from git
42
+ branches= Dir.entries( File.join(find_repo(git_dir),'.git/refs/heads/') ).delete_if {|i|
43
+ i=='.' || i=='..'
44
+ }
45
+ branch= branches.include?('ticgit-ng') ? ('ticgit-ng') : ('ticgit')
46
+
47
+ @tic_dir = opts[:tic_dir] ||"~/.#{branch}"
41
48
  @tic_working = opts[:working_directory] || File.expand_path(File.join(@tic_dir, proj, 'working'))
42
49
  @tic_index = opts[:index_file] || File.expand_path(File.join(@tic_dir, proj, 'index'))
43
50
 
44
- @logger = opts[:logger] || Logger.new(STDOUT)
45
51
  @last_tickets = []
46
52
 
47
53
  #expire @tic_index and @tic_working if it mtime is older than
@@ -51,7 +57,11 @@ module TicGitNG
51
57
  #the previous instance of the temp dir.
52
58
  if File.exist?(@tic_working)
53
59
  cache_mtime=File.mtime(@tic_working)
54
- (gitlog_mtime=git.gblob(which_branch?).log(1).map {|l| l.committer.date }[0]) rescue reset_cache
60
+ begin
61
+ gitlog_mtime= File.mtime(File.join( find_repo('.'), ".git/refs/heads/#{branch}" ))
62
+ rescue
63
+ reset_cache
64
+ end
55
65
 
56
66
  #unless (cache_mtime > gitlog_mtime.-(20) and cache_mtime <= gitlog_mtime) or (cache_mtime > gitlog_mtime.+(30) and cache_mtime >= gitlog_mtime)
57
67
  #FIXME break logic out into several lines
@@ -73,16 +83,15 @@ module TicGitNG
73
83
 
74
84
  @state = File.expand_path(File.join(@tic_dir, proj, 'state'))
75
85
 
76
- branches=git.lib.branches_all.map{|b|b.first}
77
- unless branches.include?(which_branch?) && File.directory?(@tic_working)
78
- if branches.include?(which_branch?) and !File.exist?(@tic_working)
86
+ unless branches.include?(branch) && File.directory?(@tic_working)
87
+ if branches.include?(branch) and !File.exist?(@tic_working)
79
88
  #branch exists but tic_working doesn't
80
89
  #this could be because the dir was deleted or the repo itself
81
90
  #was moved, so recreate the dir.
82
91
  reset_ticgitng
83
92
  elsif @init
84
93
  puts "Initializing TicGit-ng"
85
- init_ticgitng_branch( branches.include?(which_branch?) )
94
+ init_ticgitng_branch( branches.include?(branch) )
86
95
  else
87
96
  puts "Please run `ti init` to initialize TicGit-ng for this repository before running other ti commands."
88
97
  exit
@@ -438,6 +447,7 @@ module TicGitNG
438
447
  else
439
448
  return 'ticgit'
440
449
  end
450
+
441
451
  #If has ~/.ticgit dir, and 'ticgit' branch
442
452
  #If has ~/.ticgit-ng dir, and 'ticgit-ng' branch, and not ~/.ticgit dir and not 'ticgit' branch
443
453
  end
@@ -1,3 +1,3 @@
1
1
  module TicGitNG
2
- VERSION = '1.0.2.15'
2
+ VERSION = '1.0.2.16'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TicGit-ng
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 119
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 2
10
- - 15
11
- version: 1.0.2.15
10
+ - 16
11
+ version: 1.0.2.16
12
12
  platform: ruby
13
13
  authors:
14
14
  - Scott Chacon
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-08-12 00:00:00 Z
20
+ date: 2012-08-13 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: git