git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francesco Pretto <ceztko@gmail.com>
To: git@vger.kernel.org
Cc: Francesco Pretto <ceztko@gmail.com>
Subject: [PATCH] git-submodule.sh: Support 'checkout' as a valid update command
Date: Mon,  6 Jan 2014 19:58:46 +0100	[thread overview]
Message-ID: <1389034726-8744-1-git-send-email-ceztko@gmail.com> (raw)

According to "Documentation/gitmodules.txt", 'checkout' is a valid
'submodule.<name>.update' command. Also "git-submodule.sh" refers to
it and processes it correctly. Reflecting commit 'ac1fbb' to support
this syntax and also validate property values during 'update' command,
issuing an error if the value found is unknown.

Signed-off-by: Francesco Pretto <ceztko@gmail.com>
---
 git-submodule.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 2677f2e..4a30087 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -622,7 +622,7 @@ cmd_init()
 		   test -z "$(git config submodule."$name".update)"
 		then
 			case "$upd" in
-			rebase | merge | none)
+			checkout | rebase | merge | none)
 				;; # known modes of updating
 			*)
 				echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'"
@@ -805,6 +805,17 @@ 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
 		fi
 
 		displaypath=$(relative_path "$prefix$sm_path")
-- 
1.8.5.2.229.g4448466.dirty

             reply	other threads:[~2014-01-06 18:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 18:58 Francesco Pretto [this message]
2014-01-06 23:48 ` [PATCH] git-submodule.sh: Support 'checkout' as a valid update command Junio C Hamano
2014-01-07  0:05   ` Francesco Pretto
2014-01-07 16:12     ` Junio C Hamano
2014-01-07 17:42       ` Francesco Pretto
2014-01-07  1:16   ` Francesco Pretto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389034726-8744-1-git-send-email-ceztko@gmail.com \
    --to=ceztko@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).