threads / patch / 26962

patch, 2 partsgit-svn: Cache results of running the executable "git config"

Subject: [PATCH 2/2] git-svn: Cache results of running the executable "git config"

## tl;dr

3 messages between Apr 1, 2011 and Apr 1, 2011. Diffs are folded; open one to read it.

replies: 2people: 1as markdown or json

Alejandro R. Sedeño· Apr 1, 2011, 18:42 UTC · lore

a couple of git-svn patches

Here are two independent git-svn patches that my co-worker handed off to me back in January.

The first changes the behavior of commit_url to be like that of url so that you can commit to multiple branches.

The second uses Memoize to cache the results of shelling out to git-config, which has good performance benefits for git-svn fetch.

Alejandro R. Sedeño· Apr 1, 2011, 18:42 UTC · re: Alejandro R. Sedeño · lore

[PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config

From: James Knight <jknight@itasoftware.com>
This is necessary if you want to be able to commit to multiple branches.
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 git-svn.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to git-svn.perl +3 −1
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1..aa41896 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -523,12 +523,14 @@ sub cmd_dcommit {
 	}
 
 	if (defined $_commit_url) {
-		$url = $_commit_url;
+		$url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');
 	} else {
 		$url = eval { command_oneline('config', '--get',
 			      "svn-remote.$gs->{repo_id}.commiturl") };
 		if (!$url) {
 			$url = $gs->full_url
+		} else {
+			$url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');
 		}
 	}
 
-- 
1.7.4.2.1.gd6f1f
Alejandro R. Sedeño· Apr 1, 2011, 18:42 UTC · re: Alejandro R. Sedeño · lore
From: James Y Knight <jknight@itasoftware.com>
Running programs is not cheap!
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 git-svn.perl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Show changes to git-svn.perl +5 −0
diff --git a/git-svn.perl b/git-svn.perl
index aa41896..e47e04c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -59,6 +59,7 @@ use File::Find;
 use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
 use IPC::Open3;
 use Git;
+use Memoize;  # core since 5.8.0, Jul 2002
 
 BEGIN {
 	# import functions from Git into our packages, en masse
@@ -72,6 +73,8 @@ BEGIN {
 			*{"${package}::$_"} = \&{"Git::$_"};
 		}
 	}
+	Memoize::memoize 'Git::config';
+	Memoize::memoize 'Git::config_bool';
 }
 
 my ($SVN);
@@ -3199,6 +3202,8 @@ sub has_no_changes {
 		Memoize::unmemoize 'check_cherry_pick';
 		Memoize::unmemoize 'has_no_changes';
 	}
+
+	Memoize::memoize 'Git::SVN::repos_root';
 }
 
 END {
-- 
1.7.4.2.1.gd6f1f

← back to recent threads