Skip to content

Commit 41bf65a

Browse files
committed
Add missing +x bit on scripts that are run and not sourced
This adds executable permissions to shell scripts that begin with a `#!` and are meant to be run rather than sourced into another script. Most of these already had those set, so the inconsistency of having a handful of them unset does not appear intended. The purpose of this change is to make clearer which .sh files are meant to be run directly in a new shell process (which is most, but not all, of them), and which are meant to be sourced into another script rather than run (i.e., those that are script "libraries"). Executable permissions are intentionally not added to .sh files without shebangs that are meant for sourcing rather than running. This was not causing test failures because the way the scripts were invoked did not rely on being able to directly execute them. Nonetheless, it is clearest for these metadata to match the scripts' shebangs. (Scripts that shouldn't have the executable bit set should likewise not have shebangs, but there didn't appear to be cases where scripts wrongly had shebangs or wrongly had +x set.) A further benefit is that executable scripts are traditionally named with no special suffix while files meant for sourcing into a shell are traditionally named with a .sh suffix. Since that is not the convention followed here, setting the executable bits may be especially useful to clarify intent. This commit also removes doubled end-of-file newlines (where a file ended in two newline characters instead of just one) where present in a few files whose permissions were being changed. The rationale for including that here, even though no other script cleanup is done here, is that sometimes this happens as an overcorrection when editing scripts on Windows, where many editors don't automatically add even a single end-of-file newline. Windows is also where intended executable bits are sometimes omitted. That, in turn, is due to the absence of a Unix-style chmod, and how Cygwin-like environments infer likely executable permissions from shebangs rather than file metadata. (git still tracks them, but Windows's own permissions system differs). Files whose metadata were not being changed were not checked for extra newlines, nor otherwise edited, here.
1 parent 095c673 commit 41bf65a

File tree

15 files changed

+0
-3
lines changed

15 files changed

+0
-3
lines changed

gix-command/tests/fixtures/win_path_lookup.sh

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ echo "#!/a/x" > a/x
77
echo "#!/b/exe" > b/exe
88
echo "#!/b/exe.com" > b/exe.com
99
echo "#!/c/x.exe" > c/x.exe
10-

gix-diff/tests/fixtures/make_blob_repo.sh

100644100755
File mode changed.

gix-dir/tests/fixtures/many-symlinks.sh

100644100755
File mode changed.

gix-dir/tests/fixtures/many.sh

100644100755
File mode changed.

gix-index/tests/fixtures/file_metadata.sh

100644100755
File mode changed.

gix-index/tests/fixtures/make_index/v2_deeper_tree.sh

100644100755
File mode changed.

gix-index/tests/fixtures/make_index/v2_icase_name_clashes.sh

100644100755
File mode changed.

gix-pathspec/tests/fixtures/match_baseline_dirs.sh

100644100755
File mode changed.

gix-pathspec/tests/fixtures/match_baseline_files.sh

100644100755
File mode changed.

gix-status/tests/fixtures/conflicts.sh

100644100755
File mode changed.

gix-status/tests/fixtures/status_many.sh

100644100755
File mode changed.

gix-status/tests/fixtures/status_submodule.sh

100644100755
File mode changed.

gix-worktree/tests/fixtures/symlink_stack.sh

100644100755
File mode changed.

gix/tests/fixtures/make_head_repos.sh

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ git clone tag-symbolic tag-detached
2727
git rev-parse point-at-tag-start > .git/HEAD.tmp
2828
mv .git/HEAD.tmp .git/HEAD
2929
)
30-

gix/tests/fixtures/make_status_repos.sh

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ git init -q untracked-only
1313
mkdir new
1414
touch new/untracked subdir/untracked
1515
)
16-

0 commit comments

Comments
 (0)