Skip to content

Commit 065dd2f

Browse files
committed
- Remove --chmod flag from push command
1 parent 1aa5206 commit 065dd2f

File tree

7 files changed

+26
-34
lines changed

7 files changed

+26
-34
lines changed

rush

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/bashly.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ commands:
159159
help: Commit message.
160160
default: automatic commit
161161

162-
- long: --chmod
163-
short: -x
164-
help: Apply the executable bit to all main and undo scripts in the git repository index.
165-
166162
- name: config
167163
alias: c
168164
group: Config

src/lib/push_repo.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ push_repo() {
1111
say "push" "$repo: adding files"
1212
git add . --all
1313

14-
if [[ -n "${args[--chmod]}" ]]; then
15-
say "push" "$repo: applying chmod +x"
16-
git ls-files | grep -E "undo|main" | xargs -I {} git update-index --chmod +x {}
14+
added_exec_files="$(git diff --cached --name-only --diff-filter=A -- \
15+
':(glob)**/main' \
16+
':(glob)**/undo' \
17+
'main' \
18+
'undo')"
19+
if [[ -n "$added_exec_files" ]]; then
20+
say "push" "$repo: applying chmod +x to new main/undo files"
21+
while IFS= read -r file; do
22+
git update-index --chmod=+x "$file"
23+
done <<< "$added_exec_files"
1724
fi
1825
say "push" "$repo: committing"
1926
git commit -am "$message"

src/lib/send_completions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ send_completions() {
7676
echo $' ;;'
7777
echo $''
7878
echo $' \'upload\'*)'
79-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "--help" "--message" "-a" "-h" "-m" "-x")" -- "$cur")'
79+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")'
8080
echo $' ;;'
8181
echo $''
8282
echo $' \'update\'*)'
@@ -100,7 +100,7 @@ send_completions() {
100100
echo $' ;;'
101101
echo $''
102102
echo $' \'push\'*)'
103-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "--help" "--message" "-a" "-h" "-m" "-x")" -- "$cur")'
103+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")'
104104
echo $' ;;'
105105
echo $''
106106
echo $' \'show\'*)'

test/approvals/rush_completions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _rush_completions() {
7474
;;
7575

7676
'upload'*)
77-
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "--help" "--message" "-a" "-h" "-m" "-x")" -- "$cur")
77+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")
7878
;;
7979

8080
'update'*)
@@ -98,7 +98,7 @@ _rush_completions() {
9898
;;
9999

100100
'push'*)
101-
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--chmod" "--help" "--message" "-a" "-h" "-m" "-x")" -- "$cur")
101+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_rush_completions_filter "--all" "--help" "--message" "-a" "-h" "-m")" -- "$cur")
102102
;;
103103

104104
'show'*)

test/approvals/rush_push_h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ Alias: upload
1414
Commit message.
1515
Default: automatic commit
1616

17-
--chmod, -x
18-
Apply the executable bit to all main and undo scripts in the git repository
19-
index.
20-
2117
--help, -h
2218
Show this help
2319

test/approve

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ describe "pull"
103103

104104
describe "push"
105105
approve "rush push" || return 0
106-
approve "rush push dannyben --chmod" || return 0
107106
approve "rush push dannyben" || return 0
108107
approve "rush push --all" || return 0
109108
approve "rush push -h"

0 commit comments

Comments
 (0)