Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: [PATCH v4 1/6] submodule: Make 'checkout' update_module explicit

From: Francesco Pretto <hidden>
Date: 2016-06-15 22:59:40

2014/1/16 W. Trevor King [off-list ref]:
Avoiding useless clones is probably more important than avoiding
duplicate "Invalid update mode" messages.
No, it's not duplicate code. I'll explain, please follow me:
quoted hunk ↗ jump to hunk
@@ -803,17 +803,10 @@ cmd_update()
                        update_module=$update
                else
                        update_module=$(git config submodule."$name".update)
-                       case "$update_module" in
-                       '')
-                               ;; # Unset update mode
-                       checkout | rebase | merge | none)
-                               ;; # Known update modes
-                       !*)
-                               ;; # Custom update command
-                       *)
-                               die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
-                               ;;
-                       esac
This is a *validation*. It's done before going more through the code
and die early.
                      *)
+                             die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
This should be an *assert* -> it means if you reach this case
statement you (programmer) have messed the code something in the code
before. In fact in my original patch I wrote something like "invalid
update_module at this flow".

Please keep both as Junio said.

Thanks,
Francesco
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help