2

I messed up so I downloaded an old commit and tried to build from some old code that functioned as intended. I see the files (Podfile, License Gemfile etc) now have a .exec extension and when I push to bitBucket they have a "+x" annotation. When you hover over it says this file is now executable.

Everything still happens to build and run successfully but why does git add this extension to my files without my say so? This issue is causing some concern on my pull request. How do I return my files to being just plainText or whatever they were originally?

I've tried to run chmod -x $(find . -type exec) in the offending directory but this doesn't seem to work.

Anyone know how restore my file to their former purity???

KarmaDeli
  • 610
  • 1
  • 6
  • 16

1 Answers1

2

You could:

Then you can commit and push again.


But make sure to use Git 2.31 (Q1 2021), because of various fixes on "git add --chmod"(man)".

See commit 9ebd7fe, commit 4896089, commit c937d70 (22 Feb 2021) by Matheus Tavares (matheustavares).
(Merged by Junio C Hamano -- gitster -- in commit f277234, 25 Feb 2021)

add: propagate --chmod errors to exit status

Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau

If add encounters an error while applying the --chmod changes, it prints a message to stderr, but exits with a success code.
This might have been an oversight, as the command does exit with a non-zero code in other situations where it cannot (or refuses to) update all of the requested paths (e.g. when some of the given paths are ignored).
So make the exit behavior more consistent by also propagating --chmod errors to the exit status.

And:

add --chmod: don't update index when --dry-run is used

Helped-by: Junio C Hamano
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau

git add --chmod(man) applies the mode changes even when --dry-run is used.
Fix that and add some tests for this option combination.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I just tried git add chmod=-x Podfile in terminal and got-- fatal: pathspec 'chmod=-x' did not match any files. Also, is there a way remove all the .exec extensions in one command?? – KarmaDeli Mar 20 '19 at 11:15
  • @KarmaDeli Sorry, I forgot the '--' in front of the chmod, as shown in https://git-scm.com/docs/git-add#Documentation/git-add.txt---chmod-x. I have edited the answer accordingly. – VonC Mar 20 '19 at 11:37
  • @KarmaDeli For the rename part: https://stackoverflow.com/a/4509509/6309 or https://unix.stackexchange.com/q/34549/7490 – VonC Mar 20 '19 at 11:44
  • to remove all .exec use: git add --chmod=-x . – KarmaDeli Mar 20 '19 at 16:01