git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Add password parameter to git svn commands and use it when provided instead of defaulting to end-user prompt

From
Aarnaud.brejeon@gmail.com <arnaud.brejeon@gmail.com>
Date
Oct 12, 2013, 09:23 UTC
Message-ID
<1381569810-2167-1-git-send-email-arnaud.brejeon@gmail.com>
From: arnaudbrejeon <arnaud.brejeon@gmail.com>
Signed-off-by: Arnaud Brejeon <arnaud.brejeon <at> gmail.com>
---
 git-svn.perl           |    3 +++
 perl/Git/SVN/Prompt.pm |   12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index ff1ce3d..07f0a6c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -123,6 +123,7 @@ sub opt_prefix { return $_prefix || '' }
 $Git::SVN::Fetcher::_placeholder_filename = ".gitignore";
 $_q ||= 0;
 my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
+                    'password=s' => \$Git::SVN::Prompt::_password,
                     'config-dir=s' => \$Git::SVN::Ra::config_dir,
                     'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache,
                     'ignore-paths=s' => \$Git::SVN::Fetcher::_ignore_regex,
@@ -206,6 +207,7 @@ my %cmd = (
 	              'parents' => \$_parents,
 	              'tag|t' => \$_tag,
 	              'username=s' => \$Git::SVN::Prompt::_username,
+	              'password=s' => \$Git::SVN::Prompt::_password,
 	              'commit-url=s' => \$_commit_url } ],
 	tag => [ sub { $_tag = 1; cmd_branch(@_) },
 	         'Create a tag in the SVN repository',
@@ -214,6 +216,7 @@ my %cmd = (
 	           'dry-run|n' => \$_dry_run,
 	           'parents' => \$_parents,
 	           'username=s' => \$Git::SVN::Prompt::_username,
+	           'password=s' => \$Git::SVN::Prompt::_password,
 	           'commit-url=s' => \$_commit_url } ],
 	'set-tree' => [ \&cmd_set_tree,
 	                "Set an SVN repository to a git tree-ish",
diff --git a/perl/Git/SVN/Prompt.pm b/perl/Git/SVN/Prompt.pm
index e940b08..a94a847 100644
--- a/perl/Git/SVN/Prompt.pm
+++ b/perl/Git/SVN/Prompt.pm
@@ -2,7 +2,7 @@ package Git::SVN::Prompt;
 use strict;
 use warnings;
 require SVN::Core;
-use vars qw/$_no_auth_cache $_username/;
+use vars qw/$_no_auth_cache $_username $_password/;
 
 sub simple {
 	my ($cred, $realm, $default_username, $may_save, $pool) = @_;
@@ -17,8 +17,14 @@ sub simple {
 	} else {
 		username($cred, $realm, $may_save, $pool);
 	}
-	$cred->password(_read_password("Password for '" .
-	                               $cred->username . "': ", $realm));
+
+	if (defined $_password && length $_password) {
+		$cred->password($_password);
+	} else {
+		$cred->password(_read_password("Password for '" .
+		                               $cred->username . "': ", $realm));
+	}
+
 	$cred->may_save($may_save);
 	$SVN::_Core::SVN_NO_ERROR;
 }
-- 
1.7.10.2 (Apple Git-33)
Next: arnaud.brejeon@gmail.com
Message 1 of 9 in “Add password parameter to git svn commands and use it when provided instead of defaulting to end-user prompt”
  1. 1/2 Add password parameter to git svn commands and use it when provided instead of defaulting to end-user promptarnaud.brejeon@gmail.com, Oct 12, 2013
  2. 2/2 Add SVN trust-server-cert parameter to git svn to accept SSL server certificates from unknwon authorities without promptingarnaud.brejeon@gmail.com, Oct 12, 2013
  3. Jonathan NiederOct 14, 2013
  4. Eric WongOct 14, 2013
  5. Jeff KingOct 14, 2013
  6. Eric WongOct 14, 2013
  7. arnaud brejeonOct 15, 2013
  8. arnaud brejeonOct 21, 2013
  9. Jeff KingOct 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.