Skip to content

Commit e35b848

Browse files
committed
Remove dry-run flag as it's not implemented. Make sure branch --force delete worktree.
1 parent f4b2c2f commit e35b848

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/git-subrepo

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Options:
5858
h Show the command summary
5959
help Help overview
6060
version Print the git-subrepo version number
61-
61+
6262
a,all Perform command on all current subrepos
6363
A,ALL Perform command on all subrepos and subsubrepos
6464
b,branch= Specify the upstream branch to push/pull/fetch
@@ -68,11 +68,10 @@ F,fetch Fetch the upstream content first
6868
M,method= Method when you join, valid options are 'merge' or 'rebase'
6969
Default is 'merge'
7070
m,message= Specify a commit message
71-
N,dry-run Don't push or commit (prints next commands to run)
7271
r,remote= Specify the upstream remote to push/pull/fetch
7372
s,squash Squash commits on push
7473
u,update Add the --branch and/or --remote overrides to .gitrepo
75-
74+
7675
q,quiet Show minimal output
7776
v,verbose Show verbose output
7877
d,debug Show the actual commands used
@@ -91,7 +90,6 @@ main() {
9190

9291
local all_wanted=false # Apply command to all subrepos
9392
local ALL_wanted=false # Apply command to all subrepos and subsubrepos
94-
local dry_run_wanted=false # Skip commits and pushes
9593
local force_wanted=false # Force certain operations
9694
local fetch_wanted=false # Fetch requested before a command
9795
local squash_wanted=false # Squash commits on push
@@ -275,6 +273,8 @@ command:branch() {
275273

276274
local branch="subrepo/$subref"
277275
if $force_wanted; then
276+
# We must make sure that the worktree is removed as well
277+
worktree="$GIT_TMP/$branch"
278278
git:delete-branch "$branch"
279279
fi
280280

@@ -1007,7 +1007,6 @@ get-command-options() {
10071007
shift;;
10081008
-M) join_method="$1"
10091009
shift;;
1010-
-N) dry_run_wanted=true ;;
10111010
-r) subrepo_remote="$1"
10121011
override_remote="$1"
10131012
commit_msg_args+=("--remote=$1")
@@ -1041,7 +1040,7 @@ get-command-options() {
10411040
fi
10421041
commit_msg_args+=("${command_arguments[@]}")
10431042

1044-
for option in all ALL dry_run edit fetch force squash; do
1043+
for option in all ALL edit fetch force squash; do
10451044
var="${option}_wanted"
10461045
if ${!var}; then
10471046
check_option $option
@@ -1074,7 +1073,7 @@ options_commit='edit fetch force message'
10741073
options_fetch='all branch remote'
10751074
options_init='branch remote method'
10761075
options_pull='all branch edit force message remote update'
1077-
options_push='all branch dry_run force remote squash update'
1076+
options_push='all branch force remote squash update'
10781077
options_status='ALL all fetch'
10791078
check_option() {
10801079
local var="options_${command//-/_}"
@@ -1754,7 +1753,7 @@ git:remove-worktree() {
17541753

17551754
git:delete-branch() {
17561755
local branch="$1"
1757-
o "Deleting old '$branch_name' branch."
1756+
o "Deleting old '$branch' branch."
17581757
# Remove worktree first, otherwise you can't delete the branch
17591758
git:remove-worktree
17601759
FAIL=false RUN git branch -D "$branch"

0 commit comments

Comments
 (0)