braid 1.0.18 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91ffaf5ed3caf78d594252885a0a420faa985530
4
- data.tar.gz: 34467d809339f7035e29ea3f53c88e322f391ee2
3
+ metadata.gz: f27ef2c42cd4181967aa09dfb553f0830e15185c
4
+ data.tar.gz: f138de7633616c00ee483c9b58902cdb8e313b3c
5
5
  SHA512:
6
- metadata.gz: 2e481ed9197ec3a0d48a2b76a1697cd7407fa36cc7ef4f5a8f045a1a2aac101d1f67f3f16412fdd79620cb6cd7b31e166320c574e97a9b57cea5716011b29ba9
7
- data.tar.gz: f7222bc8ac1b732b44eaa038310ec5f7fd50c2a7b63164d1dec0aba6157305122940167f8775804b1962b85889251ffc67aa1bfafbe3a843e5fb5f580eb8862d
6
+ metadata.gz: 4305c95e52816fe64157d24e263d1d1309cd490ae8caf203c74d3fbfbb32951072a4fa387ab27e3e8cc20b227142204d1fade6f2fdab08ea93219e9479071a14
7
+ data.tar.gz: 1896dce83a4f455cd189ef87cb1fe09aeff7b81cc4ba327cc5f36c2c0310027b0ea061c45f1f426ac4fddb2466c0a511a37cd1d4e0da283fea1e4a85cfd3e7d4
@@ -33,7 +33,14 @@ module Braid
33
33
  clear_remote(mirror, options)
34
34
  return
35
35
  end
36
+ local_mirror_tree = git.rev_parse("HEAD:#{mirror.path}")
36
37
 
38
+ odb_paths = [File.expand_path(git.repo_file_path('objects'))]
39
+ if File.exist?(mirror.cached_url)
40
+ Dir.chdir(mirror.cached_url) do
41
+ odb_paths.push(File.expand_path(git.repo_file_path('objects')))
42
+ end
43
+ end
37
44
  clone_dir = Dir.tmpdir + "/braid_push.#{$$}"
38
45
  Dir.mkdir(clone_dir)
39
46
  remote_url = git.remote_url(mirror.remote)
@@ -49,12 +56,20 @@ module Braid
49
56
  git.init
50
57
  git.config(['--local', 'user.name', "\"#{user_name}\""]) if user_name
51
58
  git.config(['--local', 'user.email', "\"#{user_email}\""]) if user_email
52
- git.fetch(mirror.cached_url) if File.exist?(mirror.cached_url)
59
+ # Adding other repositories as alternates is safe (we don't have to
60
+ # worry about them being moved or deleted during the lifetime of this
61
+ # temporary repository) and faster than fetching from them. We don't
62
+ # need git.repo_file_path because the temporary repository isn't using
63
+ # a linked worktree.
64
+ File.open('.git/objects/info/alternates', 'w') { |f|
65
+ f.puts(odb_paths)
66
+ }
53
67
  git.fetch(remote_url, mirror.remote_ref)
54
68
  git.checkout(base_revision)
55
- args =[]
56
- args << "--directory=#{mirror.remote_path}" if mirror.remote_path
57
- git.apply(diff, args)
69
+ git.rm_r(mirror.remote_path || '.')
70
+ # Yes, when mirror.remote_path is unset, "git read-tree --prefix=/"
71
+ # seems to work. :/
72
+ git.read_tree_prefix_u(local_mirror_tree, mirror.remote_path || '')
58
73
  system('git commit -v')
59
74
  msg "Pushing changes to remote branch #{branch}."
60
75
  git.push(remote_url, "HEAD:refs/heads/#{branch}")
data/lib/braid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Braid
2
- VERSION = '1.0.18'
2
+ VERSION = '1.0.19'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristi Balan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-03-31 00:00:00.000000000 Z
13
+ date: 2017-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: main