1 |
From f3ae0003f8cb0c5f4fc8728254ee05bda38d7304 Mon Sep 17 00:00:00 2001 |
2 |
From: Ross Konsolebox <konsolebox@×××××.com> |
3 |
Date: Sun, 24 Jan 2016 16:27:36 +0800 |
4 |
Subject: [PATCH] Add sync-git-clone-extra-opts and sync-git-pull-extra-opts |
5 |
|
6 |
--- |
7 |
man/portage.5 | 6 ++++++ |
8 |
pym/portage/sync/modules/git/__init__.py | 5 ++++- |
9 |
pym/portage/sync/modules/git/git.py | 4 ++++ |
10 |
3 files changed, 14 insertions(+), 1 deletion(-) |
11 |
|
12 |
diff --git a/man/portage.5 b/man/portage.5 |
13 |
index c9e70a0..7c2a8f7 100644 |
14 |
--- a/man/portage.5 |
15 |
+++ b/man/portage.5 |
16 |
@@ -968,6 +968,12 @@ Specifies CVS repository. |
17 |
Specifies clone depth to use for DVCS repositories. Defaults to 1 (only |
18 |
the newest commit). If set to 0, the depth is unlimited. |
19 |
.TP |
20 |
+.B sync\-git\-clone\-extra\-opts |
21 |
+Extra options to give to git when cloning repository (git clone). |
22 |
+.TP |
23 |
+.B sync\-git\-pull\-extra\-opts |
24 |
+Extra options to give to git when updating repository (git pull). |
25 |
+.TP |
26 |
.B sync\-hooks\-only\-on\-change |
27 |
If set to true, then sync of a given repository will not trigger postsync |
28 |
hooks unless hooks would have executed for a master repository or the |
29 |
diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py |
30 |
index da46b7f..357eb82 100644 |
31 |
--- a/pym/portage/sync/modules/git/__init__.py |
32 |
+++ b/pym/portage/sync/modules/git/__init__.py |
33 |
@@ -50,7 +50,10 @@ def check_depth(self): |
34 |
'exists and is a valid Git repository', |
35 |
}, |
36 |
'validate_config': CheckGitConfig, |
37 |
- 'module_specific_options': (), |
38 |
+ 'module_specific_options': ( |
39 |
+ 'sync-git-clone-extra-opts', |
40 |
+ 'sync-git-pull-extra-opts', |
41 |
+ ), |
42 |
} |
43 |
} |
44 |
} |
45 |
diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py |
46 |
index 179c0de..e6724f6 100644 |
47 |
--- a/pym/portage/sync/modules/git/git.py |
48 |
+++ b/pym/portage/sync/modules/git/git.py |
49 |
@@ -54,6 +54,8 @@ def new(self, **kwargs): |
50 |
git_cmd_opts += " --quiet" |
51 |
if self.repo.sync_depth is not None: |
52 |
git_cmd_opts += " --depth %d" % self.repo.sync_depth |
53 |
+ if self.repo.module_specific_options.get('sync-git-clone-extra-opts'): |
54 |
+ git_cmd_opts += " %s" % self.repo.module_specific_options['sync-git-clone-extra-opts'] |
55 |
git_cmd = "%s clone%s %s ." % (self.bin_command, git_cmd_opts, |
56 |
portage._shell_quote(sync_uri)) |
57 |
writemsg_level(git_cmd + "\n") |
58 |
@@ -79,6 +81,8 @@ def update(self): |
59 |
git_cmd_opts = "" |
60 |
if self.settings.get("PORTAGE_QUIET") == "1": |
61 |
git_cmd_opts += " --quiet" |
62 |
+ if self.repo.module_specific_options.get('sync-git-pull-extra-opts'): |
63 |
+ git_cmd_opts += " %s" % self.repo.module_specific_options['sync-git-pull-extra-opts'] |
64 |
git_cmd = "%s pull%s" % (self.bin_command, git_cmd_opts) |
65 |
writemsg_level(git_cmd + "\n") |
66 |
|
67 |
|
68 |
-- |
69 |
Brian Dolbec <dolsen> |