Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How to use EGIT to change a file to executable(EGIT tool)
How to use EGIT to change a file to executable [message #1779224] Thu, 04 January 2018 08:00 Go to next message
Andy Ho is currently offline Andy HoFriend
Messages: 2
Registered: January 2018
Junior Member
I would like to change a file e.g. a shell script A.sh to have executable permission like 777. How can I do it in EGIT instead to do this manually in LINUX filesystem.
Re: How to use EGIT to change a file to executable [message #1779281 is a reply to message #1779224] Thu, 04 January 2018 18:17 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1032
Registered: July 2009
Senior Member
Why should this be EGit's business ? This is in no way related to git functionality but
rather generic file handling.

You can do this in the following way using the Eclipse resource model:
- select the file e.g. in project explorer or open in it in Eclipse text editor
- click "Properties > Resource" in the context menu
- under "Permissions" you find checkboxes allowing to change permissions
Re: How to use EGIT to change a file to executable [message #1779305 is a reply to message #1779281] Fri, 05 January 2018 07:40 Go to previous messageGo to next message
Andy Ho is currently offline Andy HoFriend
Messages: 2
Registered: January 2018
Junior Member
Hi Matthias,

Thanks for the reply. However if we follow the steps in Eclipse or using generic file handling way we will not be able to commit and push the file to be executable.
When there is a jenkins job for example, after it finished clone and then run the abc.sh it does not able to run due it is not executable.

In svn plugin like subclipse, we have something like Set property svn:exeutable

Thanks

[Updated on: Fri, 05 January 2018 07:42]

Report message to a moderator

Re: How to use EGIT to change a file to executable [message #1779313 is a reply to message #1779305] Fri, 05 January 2018 09:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29536
Registered: July 2009
Senior Member
Can't you do something like ". abc.sh" or "bash abc.sh" or "source abc.sh" so that it doesn't need execute permission?
Re: How to use EGIT to change a file to executable [message #1779412 is a reply to message #1779313] Sat, 06 January 2018 18:59 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1032
Registered: July 2009
Senior Member
Set the resource executable using checkboxes in Resource properties and then stage this mode change using EGit
and then you can commit and push that modification using EGit. I noticed that the staging view doesn't notice the
mode change (that's a bug). Though if you click the refresh button in the staging view it will notice that the file mode changed
and you can stage and commit this modification.
Re: How to use EGIT to change a file to executable [message #1779413 is a reply to message #1779412] Sat, 06 January 2018 19:21 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1032
Registered: July 2009
Senior Member
@Ed: is there an event fired by Eclipse when file mode (execute bit) changes ? Couldn't find a matching constant in IResourceDelta.
Re: How to use EGIT to change a file to executable [message #1779419 is a reply to message #1779413] Sun, 07 January 2018 06:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29536
Registered: July 2009
Senior Member
I don't think so. Looking at org.eclipse.core.internal.localstore.FileSystemResourceManager.setResourceAttributes(IResource, ResourceAttributes) it appears to be operating on the undelrying files as one would expect, but it only calls the workspace's refresh manager in the case that the executable state of a folder is actually changed. So no, it appears you can't know that this state change has occurred via an IResourceDelta, or via any other mechanism. That seems unfortunate, e.g., it wouldn't be possible to implement a label decorator that showed such bits.
Re: How to use EGIT to change a file to executable [message #1780550 is a reply to message #1779419] Tue, 23 January 2018 20:34 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1032
Registered: July 2009
Senior Member
I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=530209 to track this missing platform feature.
Previous Topic:Cancelling a JGit operation
Next Topic:push fails due to SocketException: Connection reset or cannot open git-receive-pack
Goto Forum:
  


Current Time: Wed Sep 19 00:09:05 GMT 2018

Powered by FUDForum. Page generated in 0.01599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top