remote-bzr: add support for fecthing special modes
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
77b71edfb5
commit
bdeeb809d7
@ -198,15 +198,31 @@ def export_files(tree, files):
|
||||
|
||||
final = []
|
||||
for path, fid in files.iteritems():
|
||||
kind = tree.kind(fid)
|
||||
|
||||
h = tree.get_file_sha1(fid)
|
||||
|
||||
if kind == 'symlink':
|
||||
d = tree.get_symlink_target(fid)
|
||||
mode = '120000'
|
||||
elif kind == 'file':
|
||||
|
||||
if tree.is_executable(fid):
|
||||
mode = '100755'
|
||||
else:
|
||||
mode = '100644'
|
||||
|
||||
# is the blob already exported?
|
||||
# is the blog already exported?
|
||||
if h in filenodes:
|
||||
mark = filenodes[h]
|
||||
else:
|
||||
final.append((mode, mark, path))
|
||||
continue
|
||||
|
||||
d = tree.get_file_text(fid)
|
||||
elif kind == 'directory':
|
||||
continue
|
||||
else:
|
||||
die("Unhandled kind '%s' for path '%s'" % (kind, path))
|
||||
|
||||
mark = marks.next_mark()
|
||||
filenodes[h] = mark
|
||||
|
@ -108,4 +108,36 @@ test_expect_success 'roundtrip' '
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
cat > expected <<EOF
|
||||
100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
|
||||
100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
|
||||
120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
|
||||
EOF
|
||||
|
||||
test_expect_success 'special modes' '
|
||||
(cd bzrrepo &&
|
||||
echo exec > executable
|
||||
chmod +x executable &&
|
||||
bzr add executable
|
||||
bzr commit -m exec &&
|
||||
ln -s content link
|
||||
bzr add link
|
||||
bzr commit -m link &&
|
||||
mkdir dir &&
|
||||
bzr add dir &&
|
||||
bzr commit -m dir) &&
|
||||
|
||||
(cd gitrepo &&
|
||||
git pull
|
||||
git ls-tree HEAD > ../actual) &&
|
||||
|
||||
test_cmp expected actual &&
|
||||
|
||||
(cd gitrepo &&
|
||||
git cat-file -p HEAD:link > ../actual) &&
|
||||
|
||||
echo -n content > expected &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user