git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Henri GEIST <geist.henri@laposte.net>
To: git@vger.kernel.org
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>
Subject: [PATCH/RFC] git-gui: Add a 'recursive' checkbox in the clone menu.
Date: Wed, 05 Mar 2014 00:01:16 +0100	[thread overview]
Message-ID: <1393974076.7891.27.camel@Naugrim> (raw)

[-- Attachment #1: Type: text/plain, Size: 2714 bytes --]

Permit to do a 'git clone --recursive' through git-gui.

Signed-off-by: Henri GEIST <geist.henri@laposte.net>
---
I have set the default checkbox state to 'true' by default has all my gui users
use it all the time this way.
But as it change the default behavior you may prefer to set it to 'false' by
default.

 git-gui/lib/choose_repository.tcl |   34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl
index 3c10bc6..47d436b 100644
--- a/git-gui/lib/choose_repository.tcl
+++ b/git-gui/lib/choose_repository.tcl
@@ -18,6 +18,7 @@ field local_path       {} ; # Where this repository is locally
 field origin_url       {} ; # Where we are cloning from
 field origin_name  origin ; # What we shall call 'origin'
 field clone_type hardlink ; # Type of clone to construct
+field recursive      true ; # Recursive cloning flag
 field readtree_err        ; # Error output from read-tree (if any)
 field sorted_recent       ; # recent repositories (sorted)
 
@@ -525,6 +526,11 @@ method _do_clone {} {
 	foreach r $w_types {
 		pack $r -anchor w
 	}
+	${NS}::checkbutton $args.type_f.recursive \
+		-text [mc "Recursive (For submodules)"] \
+		-variable @recursive \
+		-onvalue true -offvalue false
+	pack $args.type_f.recursive
 	grid $args.type_l $args.type_f -sticky new
 
 	grid columnconfigure $args 1 -weight 1
@@ -952,6 +958,30 @@ method _do_clone_checkout {HEAD} {
 	fileevent $fd readable [cb _readtree_wait $fd]
 }
 
+method _do_validate_submodule_cloning {ok} {
+	if {$ok} {
+		$o_cons done $ok
+		set done 1
+	} else {
+		_clone_failed $this [mc "Cannot clone submodules."]
+	}
+}
+
+method _do_clone_submodules {} {
+	if {$recursive eq {true}} {
+		destroy $w_body
+		set o_cons [console::embed \
+			$w_body \
+			[mc "Cloning submodules"]]
+		pack $w_body -fill both -expand 1 -padx 10
+		$o_cons exec \
+			[list git submodule update --init --recursive] \
+			[cb _do_validate_submodule_cloning]
+	} else {
+		set done 1
+	}
+}
+
 method _readtree_wait {fd} {
 	set buf [read $fd]
 	$o_cons update_meter $buf
@@ -982,7 +1012,7 @@ method _readtree_wait {fd} {
 		fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
 		fileevent $fd_ph readable [cb _postcheckout_wait $fd_ph]
 	} else {
-		set done 1
+		_do_clone_submodules $this
 	}
 }
 
@@ -996,7 +1026,7 @@ method _postcheckout_wait {fd_ph} {
 			hook_failed_popup post-checkout $pch_error 0
 		}
 		unset pch_error
-		set done 1
+		_do_clone_submodules $this
 		return
 	}
 	fconfigure $fd_ph -blocking 0
-- 
1.7.9.3.369.gd715.dirty


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

             reply	other threads:[~2014-03-04 23:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 23:01 Henri GEIST [this message]
2014-03-05 18:00 ` [PATCH/RFC] git-gui: Add a 'recursive' checkbox in the clone menu Jens Lehmann
2014-03-06  0:15   ` Henri GEIST
2014-03-06 19:35     ` Jens Lehmann
2014-03-06 22:00       ` Heiko Voigt
2014-03-11 11:07   ` Henri GEIST
2014-03-11 17:34     ` Jens Lehmann

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1393974076.7891.27.camel@Naugrim \
    --to=geist.henri@laposte.net \
    --cc=git@vger.kernel.org \
    --cc=patthoyts@users.sourceforge.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).