From 41bf65adef6f7d2cdd28fede262173ec7ba10822 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 13 Apr 2024 17:38:35 -0400 Subject: [PATCH] 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. --- gix-command/tests/fixtures/win_path_lookup.sh | 1 - gix-diff/tests/fixtures/make_blob_repo.sh | 0 gix-dir/tests/fixtures/many-symlinks.sh | 0 gix-dir/tests/fixtures/many.sh | 0 gix-index/tests/fixtures/file_metadata.sh | 0 gix-index/tests/fixtures/make_index/v2_deeper_tree.sh | 0 gix-index/tests/fixtures/make_index/v2_icase_name_clashes.sh | 0 gix-pathspec/tests/fixtures/match_baseline_dirs.sh | 0 gix-pathspec/tests/fixtures/match_baseline_files.sh | 0 gix-status/tests/fixtures/conflicts.sh | 0 gix-status/tests/fixtures/status_many.sh | 0 gix-status/tests/fixtures/status_submodule.sh | 0 gix-worktree/tests/fixtures/symlink_stack.sh | 0 gix/tests/fixtures/make_head_repos.sh | 1 - gix/tests/fixtures/make_status_repos.sh | 1 - 15 files changed, 3 deletions(-) mode change 100644 => 100755 gix-command/tests/fixtures/win_path_lookup.sh mode change 100644 => 100755 gix-diff/tests/fixtures/make_blob_repo.sh mode change 100644 => 100755 gix-dir/tests/fixtures/many-symlinks.sh mode change 100644 => 100755 gix-dir/tests/fixtures/many.sh mode change 100644 => 100755 gix-index/tests/fixtures/file_metadata.sh mode change 100644 => 100755 gix-index/tests/fixtures/make_index/v2_deeper_tree.sh mode change 100644 => 100755 gix-index/tests/fixtures/make_index/v2_icase_name_clashes.sh mode change 100644 => 100755 gix-pathspec/tests/fixtures/match_baseline_dirs.sh mode change 100644 => 100755 gix-pathspec/tests/fixtures/match_baseline_files.sh mode change 100644 => 100755 gix-status/tests/fixtures/conflicts.sh mode change 100644 => 100755 gix-status/tests/fixtures/status_many.sh mode change 100644 => 100755 gix-status/tests/fixtures/status_submodule.sh mode change 100644 => 100755 gix-worktree/tests/fixtures/symlink_stack.sh mode change 100644 => 100755 gix/tests/fixtures/make_head_repos.sh mode change 100644 => 100755 gix/tests/fixtures/make_status_repos.sh diff --git a/gix-command/tests/fixtures/win_path_lookup.sh b/gix-command/tests/fixtures/win_path_lookup.sh old mode 100644 new mode 100755 index 7d351f0b13d..91770e15086 --- a/gix-command/tests/fixtures/win_path_lookup.sh +++ b/gix-command/tests/fixtures/win_path_lookup.sh @@ -7,4 +7,3 @@ echo "#!/a/x" > a/x echo "#!/b/exe" > b/exe echo "#!/b/exe.com" > b/exe.com echo "#!/c/x.exe" > c/x.exe - diff --git a/gix-diff/tests/fixtures/make_blob_repo.sh b/gix-diff/tests/fixtures/make_blob_repo.sh old mode 100644 new mode 100755 diff --git a/gix-dir/tests/fixtures/many-symlinks.sh b/gix-dir/tests/fixtures/many-symlinks.sh old mode 100644 new mode 100755 diff --git a/gix-dir/tests/fixtures/many.sh b/gix-dir/tests/fixtures/many.sh old mode 100644 new mode 100755 diff --git a/gix-index/tests/fixtures/file_metadata.sh b/gix-index/tests/fixtures/file_metadata.sh old mode 100644 new mode 100755 diff --git a/gix-index/tests/fixtures/make_index/v2_deeper_tree.sh b/gix-index/tests/fixtures/make_index/v2_deeper_tree.sh old mode 100644 new mode 100755 diff --git a/gix-index/tests/fixtures/make_index/v2_icase_name_clashes.sh b/gix-index/tests/fixtures/make_index/v2_icase_name_clashes.sh old mode 100644 new mode 100755 diff --git a/gix-pathspec/tests/fixtures/match_baseline_dirs.sh b/gix-pathspec/tests/fixtures/match_baseline_dirs.sh old mode 100644 new mode 100755 diff --git a/gix-pathspec/tests/fixtures/match_baseline_files.sh b/gix-pathspec/tests/fixtures/match_baseline_files.sh old mode 100644 new mode 100755 diff --git a/gix-status/tests/fixtures/conflicts.sh b/gix-status/tests/fixtures/conflicts.sh old mode 100644 new mode 100755 diff --git a/gix-status/tests/fixtures/status_many.sh b/gix-status/tests/fixtures/status_many.sh old mode 100644 new mode 100755 diff --git a/gix-status/tests/fixtures/status_submodule.sh b/gix-status/tests/fixtures/status_submodule.sh old mode 100644 new mode 100755 diff --git a/gix-worktree/tests/fixtures/symlink_stack.sh b/gix-worktree/tests/fixtures/symlink_stack.sh old mode 100644 new mode 100755 diff --git a/gix/tests/fixtures/make_head_repos.sh b/gix/tests/fixtures/make_head_repos.sh old mode 100644 new mode 100755 index dcdc3277aef..ad2eae1f0f5 --- a/gix/tests/fixtures/make_head_repos.sh +++ b/gix/tests/fixtures/make_head_repos.sh @@ -27,4 +27,3 @@ git clone tag-symbolic tag-detached git rev-parse point-at-tag-start > .git/HEAD.tmp mv .git/HEAD.tmp .git/HEAD ) - diff --git a/gix/tests/fixtures/make_status_repos.sh b/gix/tests/fixtures/make_status_repos.sh old mode 100644 new mode 100755 index 68ff4a72669..aa9aa65d74c --- a/gix/tests/fixtures/make_status_repos.sh +++ b/gix/tests/fixtures/make_status_repos.sh @@ -13,4 +13,3 @@ git init -q untracked-only mkdir new touch new/untracked subdir/untracked ) -