@@ -316,11 +316,6 @@ rush_push_usage() {
316316 printf " %s\n" " Default: automatic commit"
317317 echo
318318
319- # :flag.usage
320- printf " %s\n" " $( green " --chmod, -x" ) "
321- printf " Apply the executable bit to all main and undo scripts in the git repository\n index.\n"
322- echo
323-
324319 # :command.usage_fixed_flags
325320 printf " %s\n" " $( green " --help, -h" ) "
326321 printf " Show this help\n"
@@ -1197,9 +1192,16 @@ push_repo() {
11971192 say " push" " $repo : adding files"
11981193 git add . --all
11991194
1200- if [[ -n " ${args[--chmod]} " ]]; then
1201- say " push" " $repo : applying chmod +x"
1202- git ls-files | grep -E " undo|main" | xargs -I {} git update-index --chmod +x {}
1195+ added_exec_files=" $( git diff --cached --name-only --diff-filter=A -- \
1196+ ' :(glob)**/main' \
1197+ ' :(glob)**/undo' \
1198+ ' main' \
1199+ ' undo' ) "
1200+ if [[ -n " $added_exec_files " ]]; then
1201+ say " push" " $repo : applying chmod +x to new main/undo files"
1202+ while IFS= read -r file; do
1203+ git update-index --chmod=+x " $file "
1204+ done <<< " $added_exec_files"
12031205 fi
12041206 say " push" " $repo : committing"
12051207 git commit -am " $message "
@@ -1325,7 +1327,7 @@ send_completions() {
13251327 echo $' ;;'
13261328 echo $' '
13271329 echo $' \' upload\' *)'
1328- echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "-- help" "--message" "-a" "-h" "-m" "-x ")" -- "$cur")'
1330+ echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")'
13291331 echo $' ;;'
13301332 echo $' '
13311333 echo $' \' update\' *)'
@@ -1349,7 +1351,7 @@ send_completions() {
13491351 echo $' ;;'
13501352 echo $' '
13511353 echo $' \' push\' *)'
1352- echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "-- help" "--message" "-a" "-h" "-m" "-x ")" -- "$cur")'
1354+ echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")'
13531355 echo $' ;;'
13541356 echo $' '
13551357 echo $' \' show\' *)'
@@ -2504,14 +2506,6 @@ rush_push_parse_requirements() {
25042506 fi
25052507 ;;
25062508
2507- # :flag.case
2508- --chmod | -x)
2509-
2510- # :flag.case_no_arg
2511- args[' --chmod' ]=1
2512- shift
2513- ;;
2514-
25152509 -?* )
25162510 printf " invalid option: %s\n" " $key " >&2
25172511 exit 1
0 commit comments