git-ds 0.9.4.3 → 0.9.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +6 -0
- data/lib/git-ds/database.rb +13 -1
- data/lib/git-ds/index.rb +2 -0
- data/lib/git-ds/repo.rb +11 -4
- metadata +4 -4
data/ChangeLog
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2011-04-15 : mkfs <mkfs@thoughtgang.org>
|
2
|
+
* Removed newline from Repo.top_level
|
3
|
+
* Added exception handling to exec_in_git
|
4
|
+
* Added Database#valid? method
|
5
|
+
* Forced an unstage() call in Repo#stage_and_commit
|
6
|
+
|
1
7
|
2011-04-14 : mkfs <mkfs@thoughtgang.org>
|
2
8
|
* Fixed broken dependency on Grit.
|
3
9
|
|
data/lib/git-ds/database.rb
CHANGED
@@ -48,14 +48,16 @@ Return a connection to the Git DB.
|
|
48
48
|
Creates the DB if it does not already exist.
|
49
49
|
=end
|
50
50
|
def initialize(path, username=nil, email=nil)
|
51
|
+
@stale = true # DB is always stale until it is initialized
|
52
|
+
|
51
53
|
init = false
|
52
54
|
if not File.exist? path
|
53
55
|
Repo.create(path)
|
54
56
|
init = true
|
55
57
|
end
|
56
58
|
|
57
|
-
@stale = false
|
58
59
|
super(path)
|
60
|
+
@stale = false # DB is connected!
|
59
61
|
|
60
62
|
if init
|
61
63
|
# initial commit is needed for branches to work smoothly
|
@@ -65,6 +67,7 @@ Creates the DB if it does not already exist.
|
|
65
67
|
end
|
66
68
|
|
67
69
|
@actor = Grit::Actor.new(username, email) if username
|
70
|
+
|
68
71
|
end
|
69
72
|
|
70
73
|
=begin rdoc
|
@@ -103,6 +106,15 @@ NOTE: This does not create a commit! Ony the staging index changes.
|
|
103
106
|
# TODO: remove all locks etc
|
104
107
|
end
|
105
108
|
|
109
|
+
=begin rdoc
|
110
|
+
Return true if the database is valid (i.e. open)
|
111
|
+
=end
|
112
|
+
def valid?
|
113
|
+
@stale == false
|
114
|
+
end
|
115
|
+
|
116
|
+
alias :connected? :valid?
|
117
|
+
|
106
118
|
=begin rdoc
|
107
119
|
Delete Database (including entire repository) from disk.
|
108
120
|
=end
|
data/lib/git-ds/index.rb
CHANGED
@@ -151,7 +151,9 @@ Index object for the Git staging index.
|
|
151
151
|
#sha = super(msg, parents, author, last_tree, @repo.current_branch)
|
152
152
|
sha = super(msg, parents, author, nil, @repo.current_branch)
|
153
153
|
if sha
|
154
|
+
# set index parent_commit to the new commit
|
154
155
|
@parent_commit = @repo.commit(sha)
|
156
|
+
# read tree back into index
|
155
157
|
read_tree(@parent_commit.tree.id)
|
156
158
|
end
|
157
159
|
sha
|
data/lib/git-ds/repo.rb
CHANGED
@@ -64,7 +64,7 @@ Return the top-level directory of the repo containing the location 'path'.
|
|
64
64
|
Dir.chdir dest
|
65
65
|
end
|
66
66
|
|
67
|
-
dir = `git rev-parse --show-toplevel
|
67
|
+
dir = `git rev-parse --show-toplevel`.chomp
|
68
68
|
Dir.chdir old_dir if old_dir
|
69
69
|
|
70
70
|
(dir == '.git') ? '.' : dir.chomp(GIT_DIR)
|
@@ -262,6 +262,7 @@ Returns SHA of commit.
|
|
262
262
|
def stage_and_commit(msg, actor=nil, &block)
|
263
263
|
stage(&block)
|
264
264
|
self.staging.commit(msg, actor)
|
265
|
+
unstage
|
265
266
|
end
|
266
267
|
|
267
268
|
# ----------------------------------------------------------------------
|
@@ -270,9 +271,15 @@ Change to the Repo#top_level dir, yield to block, then pop the dir stack.
|
|
270
271
|
=end
|
271
272
|
def exec_in_git_dir(&block)
|
272
273
|
curr = Dir.getwd
|
273
|
-
|
274
|
-
|
275
|
-
|
274
|
+
result = nil
|
275
|
+
begin
|
276
|
+
Dir.chdir top_level
|
277
|
+
result = yield
|
278
|
+
rescue
|
279
|
+
raise
|
280
|
+
ensure
|
281
|
+
Dir.chdir curr
|
282
|
+
end
|
276
283
|
result
|
277
284
|
end
|
278
285
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-ds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.4.
|
4
|
+
version: 0.9.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-04-
|
12
|
+
date: 2011-04-15 00:00:00.000000000 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: grit
|
17
|
-
requirement: &
|
17
|
+
requirement: &13294020 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 2.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *13294020
|
26
26
|
description: A hierarchical datastore based on Git.
|
27
27
|
email: community@thoughtgang.org
|
28
28
|
executables: []
|