]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote-hg: fix handling of file perms when pushing
authorMax Horn <max@quendi.de>
Tue, 15 Jan 2013 13:02:39 +0000 (14:02 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Jan 2013 18:01:11 +0000 (10:01 -0800)
Previously, when changing and committing an executable file, the file
would loose its executable bit on the hg side. Likewise, symlinks ended
up as "normal" files". This was not immediately apparent on the git side
unless one did a fresh clone.

Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-hg
contrib/remote-helpers/test-hg-hg-git.sh

index c7006000a6f4a19fa4e5f4bf3fc543d4756a1f4d..5974976f028d6d27ee5c69b1afb6823ed0509b1a 100755 (executable)
@@ -53,7 +53,7 @@ def gittz(tz):
     return '%+03d%02d' % (-tz / 3600, -tz % 3600 / 60)
 
 def hgmode(mode):
-    m = { '0100755': 'x', '0120000': 'l' }
+    m = { '100755': 'x', '120000': 'l' }
     return m.get(mode, '')
 
 def get_config(config):
index 3e76d9fb60bff8b25f5b2751c6e11cfabb6c9dc6..7e3967f5b6f0c19939bf1c0c30be0d756ec6aa04 100755 (executable)
@@ -109,6 +109,74 @@ setup () {
 
 setup
 
+test_expect_success 'executable bit' '
+       mkdir -p tmp && cd tmp &&
+       test_when_finished "cd .. && rm -rf tmp" &&
+
+       (
+       git init -q gitrepo &&
+       cd gitrepo &&
+       echo alpha > alpha &&
+       chmod 0644 alpha &&
+       git add alpha &&
+       git commit -m "add alpha" &&
+       chmod 0755 alpha &&
+       git add alpha &&
+       git commit -m "set executable bit" &&
+       chmod 0644 alpha &&
+       git add alpha &&
+       git commit -m "clear executable bit"
+       ) &&
+
+       for x in hg git; do
+               (
+               hg_clone_$x gitrepo hgrepo-$x &&
+               cd hgrepo-$x &&
+               hg_log . &&
+               hg manifest -r 1 -v &&
+               hg manifest -v
+               ) > output-$x &&
+
+               git_clone_$x hgrepo-$x gitrepo2-$x &&
+               git_log gitrepo2-$x > log-$x
+       done &&
+       cp -r log-* output-* /tmp/foo/ &&
+
+       test_cmp output-hg output-git &&
+       test_cmp log-hg log-git
+'
+
+test_expect_success 'symlink' '
+       mkdir -p tmp && cd tmp &&
+       test_when_finished "cd .. && rm -rf tmp" &&
+
+       (
+       git init -q gitrepo &&
+       cd gitrepo &&
+       echo alpha > alpha &&
+       git add alpha &&
+       git commit -m "add alpha" &&
+       ln -s alpha beta &&
+       git add beta &&
+       git commit -m "add beta"
+       ) &&
+
+       for x in hg git; do
+               (
+               hg_clone_$x gitrepo hgrepo-$x &&
+               cd hgrepo-$x &&
+               hg_log . &&
+               hg manifest -v
+               ) > output-$x &&
+
+               git_clone_$x hgrepo-$x gitrepo2-$x &&
+               git_log gitrepo2-$x > log-$x
+       done &&
+
+       test_cmp output-hg output-git &&
+       test_cmp log-hg log-git
+'
+
 test_expect_success 'merge conflict 1' '
        mkdir -p tmp && cd tmp &&
        test_when_finished "cd .. && rm -rf tmp" &&