gitlab_git 7.0.0.rc8 → 7.0.0.rc9
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/repository.rb +67 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7ec22b2587950203d9032f5751289974e071e31
|
4
|
+
data.tar.gz: fe553f891594bbb3003feb752bebdb6217b28539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0f637cfdea87897513107b35aa5166533d6e901ee2b3f8cd27aec7328aa1c4b9d68056ff89e0540aafca89d0d6799042cd9cf26674f71f421f58d49647234fe
|
7
|
+
data.tar.gz: 22b05d255f9d5be02aeb6197e04fe1f9e2243fa2c58120ad4bbac5de39f079731c2980716bb0a16d34a1ac81fbac8ef22ee83fbc80a4e6d2489d2b4a86dba46e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.0.0.
|
1
|
+
7.0.0.rc9
|
@@ -361,13 +361,15 @@ module Gitlab
|
|
361
361
|
# repo.branch_names_contains('master')
|
362
362
|
#
|
363
363
|
def branches_contains(commit)
|
364
|
-
|
364
|
+
commit_obj = rugged.rev_parse(commit)
|
365
|
+
parent = commit_obj.parents.first unless commit_obj.parents.empty?
|
365
366
|
|
366
367
|
walker = Rugged::Walker.new(rugged)
|
367
368
|
|
368
369
|
rugged.branches.select do |branch|
|
369
370
|
walker.push(branch.target_id)
|
370
|
-
|
371
|
+
walker.hide(parent) if parent
|
372
|
+
result = walker.any? { |c| c.oid == commit_obj.oid }
|
371
373
|
walker.reset
|
372
374
|
|
373
375
|
result
|
@@ -794,43 +796,80 @@ module Gitlab
|
|
794
796
|
# +follow+ option is true and the file specified by +path+ was renamed,
|
795
797
|
# then the path value is set to the old path.
|
796
798
|
def commit_touches_path?(commit, path, follow)
|
797
|
-
if
|
798
|
-
|
799
|
+
if follow
|
800
|
+
touches_path_diff?(commit, path)
|
799
801
|
else
|
800
|
-
|
801
|
-
diff.find_similar! if follow
|
802
|
+
touches_path_tree?(commit, path)
|
802
803
|
end
|
804
|
+
end
|
803
805
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
# Look for the old path in ancestors
|
810
|
-
path.replace(d.old_file[:path])
|
811
|
-
end
|
806
|
+
# Returns true if +commit+ introduced changes to +path+, using commit
|
807
|
+
# trees to make that determination.
|
808
|
+
def touches_path_tree?(commit, path)
|
809
|
+
parent = commit.parents[0]
|
810
|
+
entry = tree_entry(commit, path)
|
812
811
|
|
813
|
-
|
814
|
-
|
812
|
+
if parent.nil?
|
813
|
+
# This is the root commit, return true if it has +path+ in its tree
|
814
|
+
return entry != nil
|
815
815
|
end
|
816
816
|
|
817
|
-
|
817
|
+
parent_entry = tree_entry(parent, path)
|
818
|
+
|
819
|
+
if entry.nil? && parent_entry.nil?
|
820
|
+
false
|
821
|
+
elsif entry.nil? || parent_entry.nil?
|
822
|
+
true
|
823
|
+
else
|
824
|
+
entry[:oid] != parent_entry[:oid]
|
825
|
+
end
|
818
826
|
end
|
819
827
|
|
820
|
-
#
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
828
|
+
# Find the entry for +path+ in the tree for +commit+
|
829
|
+
def tree_entry(commit, path)
|
830
|
+
pathname = Pathname.new(path)
|
831
|
+
tmp_entry = nil
|
832
|
+
|
833
|
+
pathname.each_filename do |dir|
|
834
|
+
if tmp_entry.nil?
|
835
|
+
tmp_entry = commit.tree[dir]
|
836
|
+
else
|
837
|
+
tmp_entry = rugged.lookup(tmp_entry[:oid])[dir]
|
838
|
+
end
|
839
|
+
end
|
840
|
+
|
841
|
+
tmp_entry
|
826
842
|
end
|
827
843
|
|
828
|
-
# Returns true if
|
829
|
-
#
|
830
|
-
|
831
|
-
|
832
|
-
|
844
|
+
# Returns true if +commit+ introduced changes to +path+, using
|
845
|
+
# Rugged::Diff objects to make that determination. This is slower than
|
846
|
+
# comparing commit trees, but lets us use Rugged::Diff#find_similar to
|
847
|
+
# detect file renames.
|
848
|
+
def touches_path_diff?(commit, path)
|
849
|
+
diff = commit.diff(reverse: true, paths: [path],
|
850
|
+
disable_pathspec_match: true)
|
851
|
+
|
852
|
+
return false if diff.deltas.empty?
|
853
|
+
|
854
|
+
# If +path+ is a filename, not a directory, then we should only have
|
855
|
+
# one delta. We don't need to follow renames for directories.
|
856
|
+
return true if diff.deltas.length > 1
|
857
|
+
|
858
|
+
# Detect renames
|
859
|
+
delta = diff.deltas.first
|
860
|
+
if delta.added?
|
861
|
+
full_diff = commit.diff(reverse: true)
|
862
|
+
full_diff.find_similar!
|
863
|
+
|
864
|
+
full_diff.each_delta do |full_delta|
|
865
|
+
if full_delta.renamed? && path == full_delta.new_file[:path]
|
866
|
+
# Look for the old path in ancestors
|
867
|
+
path.replace(full_delta.old_file[:path])
|
868
|
+
end
|
869
|
+
end
|
833
870
|
end
|
871
|
+
|
872
|
+
true
|
834
873
|
end
|
835
874
|
|
836
875
|
def archive_to_file(treeish = 'master', prefix = nil, filename = 'archive.tar.gz', format = nil, compress_cmd = %W(gzip))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.0.
|
4
|
+
version: 7.0.0.rc9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Zaporozhets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|