mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-02 01:25:49 +01:00
Fix mode setting in the case of moved executable files
This commit is contained in:
@@ -778,17 +778,7 @@ def get_file_metadata(repo, p1, files):
|
||||
if 'rename' in f and 'mode' not in f:
|
||||
old = f['rename']
|
||||
ctx = repo[p1][old]
|
||||
m = ''
|
||||
# .isexec(), .islink() only around in newer versions
|
||||
if hasattr(ctx, 'isexec'):
|
||||
m = ctx.isexec()
|
||||
else:
|
||||
m = ('x' in ctx.flags())
|
||||
if hasattr(ctx, 'islink'):
|
||||
m = ctx.islink()
|
||||
else:
|
||||
m = ('l' in ctx.flags())
|
||||
f['mode'] = m
|
||||
f['mode'] = ctx.flags()
|
||||
f['data'] = ctx.data()
|
||||
|
||||
def get_merge_files(repo, p1, p2, files):
|
||||
|
||||
@@ -251,6 +251,32 @@ test_expect_success 'shared-marks unset to set' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'push with renamed executable preserves executable bit' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo*" &&
|
||||
|
||||
hg init hgrepo &&
|
||||
|
||||
(
|
||||
git init gitrepo &&
|
||||
cd gitrepo &&
|
||||
git remote add origin "hg::../hgrepo" &&
|
||||
echo one > content &&
|
||||
chmod a+x content &&
|
||||
git add content &&
|
||||
git commit -a -m one &&
|
||||
git mv content content2 &&
|
||||
git commit -a -m two &&
|
||||
git push origin master
|
||||
) &&
|
||||
|
||||
(
|
||||
cd hgrepo &&
|
||||
hg update &&
|
||||
stat content2 >expected &&
|
||||
grep -- -rwxr-xr-x expected
|
||||
)
|
||||
'
|
||||
|
||||
# cleanup setting
|
||||
git config --global --unset remote-hg.shared-marks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user