git-submodule.sh: remove unused top-level "--branch" argument
Inmaint5c08dbbdf1(git-submodule: fix subcommand parser, 2008-01-15) the "--branch" option was supported as an option to "git submodule" itself, i.e. "git submodule --branch" as a side-effect of its implementation. Then inb57e8119e6(submodule: teach set-branch subcommand, 2019-02-08) when the "set-branch" subcommand was added the assertion that we shouldn't have "--branch" anywhere except as an argument to "add" and "set-branch" was copy/pasted from the adjacent check for "--cache" added (or rather modified) in496eeeb19b(git-submodule.sh: avoid "test <cond> -a/-o <cond>", 2014-06-10). But there's been a logic error in that check, which at a glance looked like it should be supporting: git submodule --branch <branch> (add | set-branch) [<options>] But due to "||" in the condition (as opposed to "&&" for "--cache") if we have "--branch" here already we'll emit usage, even for "add" and "set-branch". So in addition to never having documented this form, it hasn't worked sinceb57e8119e6was released with v2.22.0. So it's safe to remove this code. I.e. we don't want to support the form noted above, but only: git submodule (add | set-branch) --branch <branch> [<options>] Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
							parent
							
								
									757d092797
								
							
						
					
					
						commit
						da3aae9e84
					
				|  | @ -574,14 +574,6 @@ do | ||||||
| 	-q|--quiet) | 	-q|--quiet) | ||||||
| 		GIT_QUIET=1 | 		GIT_QUIET=1 | ||||||
| 		;; | 		;; | ||||||
| 	-b|--branch) |  | ||||||
| 		case "$2" in |  | ||||||
| 		'') |  | ||||||
| 			usage |  | ||||||
| 			;; |  | ||||||
| 		esac |  | ||||||
| 		branch="$2"; shift |  | ||||||
| 		;; |  | ||||||
| 	--cached) | 	--cached) | ||||||
| 		cached=1 | 		cached=1 | ||||||
| 		;; | 		;; | ||||||
|  | @ -609,12 +601,6 @@ then | ||||||
|     fi |     fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # "-b branch" is accepted only by "add" and "set-branch" |  | ||||||
| if test -n "$branch" && (test "$command" != add || test "$command" != set-branch) |  | ||||||
| then |  | ||||||
| 	usage |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| # "--cached" is accepted only by "status" and "summary" | # "--cached" is accepted only by "status" and "summary" | ||||||
| if test -n "$cached" && test "$command" != status && test "$command" != summary | if test -n "$cached" && test "$command" != status && test "$command" != summary | ||||||
| then | then | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Ævar Arnfjörð Bjarmason
						Ævar Arnfjörð Bjarmason