summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-23 19:17:58 +0000
committerGerrit Code Review <review@openstack.org>2021-04-23 19:17:58 +0000
commitafda8ecee87034224883512f24fcbbcb22a9229a (patch)
tree762872d95e9dd3745e2c3d098e537e50cb957751
parentef1a35f4e19c0460c27c9e0577e8e41d7dd52b0b (diff)
parent39cd763d5d3ae310b00e54f6fc24eba993ed57f5 (diff)
downloadgit-review-afda8ecee87034224883512f24fcbbcb22a9229a.tar.gz
Merge "Add option for disabling thin pushes"2.1.0
-rw-r--r--git-review.14
-rw-r--r--git_review/cmd.py11
-rw-r--r--git_review/tests/test_git_review.py9
-rw-r--r--releasenotes/notes/add-no-thin-option-ea7cb50e22e7017d.yaml9
4 files changed, 31 insertions, 2 deletions
diff --git a/git-review.1 b/git-review.1
index 5b2218a..c20e06c 100644
--- a/git-review.1
+++ b/git-review.1
@@ -179,6 +179,10 @@ When submitting a change for review, you will usually want it to be based on the
Also can be used for
.Fl \-compare
to skip automatic rebase of fetched reviews.
+.It Fl \-no-thin
+Disable thin pushes when pushing to Gerrit. This should only be used if you
+are currently experiencing unpack failures due to missing trees. It should
+not be required in typical day to day use.
.It Fl \-color Ar always|never|auto
Enable or disable a color output. Default is "auto".
.It Fl \-no\-color
diff --git a/git_review/cmd.py b/git_review/cmd.py
index b3e7e38..a97a20c 100644
--- a/git_review/cmd.py
+++ b/git_review/cmd.py
@@ -1538,6 +1538,9 @@ additional information:
parser.add_argument("-l", "--list", dest="list", action="count",
help="List available reviews for the current project, "
"if passed more than once, will show more information")
+ parser.add_argument("--no-thin", dest="no_thin", action="store_true",
+ help="git push with --no-thin. This may workaround "
+ "issues with pushing in some circumstances.")
parser.add_argument("-y", "--yes", dest="yes", action="store_true",
help="Indicate that you do, in fact, understand if "
"you are submitting more than one patch")
@@ -1701,10 +1704,14 @@ additional information:
sys.exit(1)
assert_one_change(remote, branch, yes, have_hook)
+ no_thin = ''
+ if options.no_thin:
+ no_thin = '--no-thin'
+
ref = "for"
- cmd = ("git push --no-follow-tags %s HEAD:refs/%s/%s" %
- (remote, ref, branch))
+ cmd = ("git push --no-follow-tags %s %s HEAD:refs/%s/%s" %
+ (no_thin, remote, ref, branch))
push_options = []
if options.topic is not None:
topic = options.topic
diff --git a/git_review/tests/test_git_review.py b/git_review/tests/test_git_review.py
index 7bf89af..d988e1d 100644
--- a/git_review/tests/test_git_review.py
+++ b/git_review/tests/test_git_review.py
@@ -501,6 +501,15 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
def test_git_review_F_R(self):
self.assertRaises(Exception, self._run_git_review, '-F', '-R')
+ def test_git_review_no_thin(self):
+ """Test git-review --no-thin."""
+ self._run_git_review('-s')
+
+ # Push with --no-thin set. We can't really introspect the packs
+ # that were sent so we infer success as the command not failing.
+ self._simple_change('test file modified', 'test commit message')
+ self._run_git_review('--no-thin')
+
def test_config_instead_of_honored(self):
self.set_remote('test_project_url')
diff --git a/releasenotes/notes/add-no-thin-option-ea7cb50e22e7017d.yaml b/releasenotes/notes/add-no-thin-option-ea7cb50e22e7017d.yaml
new file mode 100644
index 0000000..1f6d79c
--- /dev/null
+++ b/releasenotes/notes/add-no-thin-option-ea7cb50e22e7017d.yaml
@@ -0,0 +1,9 @@
+---
+features:
+ - |
+ Add support for --no-thin which is passed to git push. This is useful to
+ work around situations where Gerrit's JGit and git-review's C git
+ implementations cannot agree on the pack file contents used to transfer
+ a push. When they disagree you see this as unpack failures due to missing
+ trees. Using --no-thin avoids complicated negotiations and works around
+ this problem.