shipit icon indicating copy to clipboard operation
shipit copied to clipboard

Fix mv -T

Open podvarkov opened this issue 6 years ago • 9 comments

Remove -T option

podvarkov avatar Feb 26 '19 06:02 podvarkov

Hello @podvarkov, thanks for your contribution, can you make tests pass?

gregberge avatar Feb 26 '19 07:02 gregberge

I tried :)

podvarkov avatar Feb 26 '19 08:02 podvarkov

So it looks like the -T was useful ;)

gregberge avatar Feb 26 '19 09:02 gregberge

Can you tell me how to run your project and tests locally? I cant run it? cause of babel imports :(

podvarkov avatar Feb 27 '19 05:02 podvarkov

Tests were broken, I fixed it. But I think removing -T is not a good thing, it is actually required.

gregberge avatar Feb 27 '19 07:02 gregberge

Tests were broken, I fixed it. But I think removing -T is not a good thing, it is actually required.

There's no "=T" option in my mac for mv. Here's the usage syntax for mv in osx:

usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

@neoziro Why is this so? Is it because there can be already existing "current" directory which would cause the "current_tmp" to move inside the "current"? If this is the case we can just delete the directory if it exists. Now, simply move the "current_tmp" to "current" using mv current_temp current.

if [ -d "current" ]; then rm -Rf current; fi && mv current_tmp current

I don't think there's any problem with this approach. Any thoughts regarding this?

utkarsh-dixit avatar Aug 30 '19 22:08 utkarsh-dixit

Yes I think you are right, it could probably exist and move it inside. We have to add a command to prevent it. Could you add it @podvarkov?

gregberge avatar Sep 18 '19 19:09 gregberge

I'm seeing the same issue with -T not being supported on the server side. I think the solution would be to replace mv -fT current_tmp current with rm current && mv -f current_tmp current. This way the link is properly renamed and the old link is removed.

IndrekV avatar Jun 18 '20 16:06 IndrekV

I ran into a similar issue deploying to FreeBSD and came up with a hack to work around it https://github.com/shipitjs/shipit/issues/173#issuecomment-751694482 however I'm not sure this will work for deploying to MacOS.

I think it maybe worth investigating some other solution for the longer term. Perhaps a move to using ln to update the symlinks rather than using mv, since it seems that mv functionality varies across platforms. Something like ln -nfs newlocation existinglink https://superuser.com/a/938865

Firer avatar Mar 07 '21 23:03 Firer