Re: [PATCH v2 0/3] limit the size of the packs we receive

2016-08-18 Thread Jeff King
On Thu, Aug 18, 2016 at 03:15:50PM +0200, Christian Couder wrote:

> Diff with previous v1 version
> ~
> 
> diff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh
> index b38d508..09e958f 100755
> --- a/t/t5546-push-limits.sh
> +++ b/t/t5546-push-limits.sh
> @@ -11,11 +11,11 @@ test_expect_success 'create remote repository' '
>  # When the limit is 1, `git receive-pack` will call `git index-pack`.
>  # When the limit is 10, `git receive-pack` will call `git unpack-objects`.
>  
> -while read unpacklimit filesize filename
> +while read unpacklimit filesize filename seed
>  do
>  
>   test_expect_success "create known-size ($filesize bytes) commit 
> '$filename'" '
> - test-genrandom foo "$filesize" >"$filename" &&
> + test-genrandom "$seed" "$filesize" >"$filename" &&
>   git add "$filename" &&
>   test_commit "$filename"
>   '
> @@ -35,8 +35,8 @@ do
>   '
>  
>  done <<\EOF
> -1 1024 one-k-file
> -10 2048 two-k-file
> +1 1024 one-k-file foo
> +10 1024 other-one-k-file bar
>  EOF
>  
>  test_done

This is still not quite what I would have written, but I don't think
it's worth arguing over.

This version looks OK to me. Thanks.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/3] limit the size of the packs we receive

2016-08-18 Thread Christian Couder
Goal


In https://public-inbox.org/git/20150612182045.GA23698%40peff.net/,
Peff sent a patch that is used by GitHub to abort `git receive-pack`
when the size of the pack we receive is bigger than a configured
limit.

GitLab is interested in using the same approach and in standardizing
the error messages the user could get back.

Comments


I kept Peff as the author of the patches that are made mostly from his
patch, but I added my Signed-off-by to them.

Changes from previous v1 version


  - removed last sentences of the commit message in patch 3/3, as
suggested by Peff,

  - improved the tests in the last patch, as suggested by Peff

Links
~

This patch series is available here:

https://github.com/chriscool/git/commits/max-receive

The previous versions are here on GitHub:

RFC: https://github.com/chriscool/git/commits/max-receive2
v1: https://github.com/chriscool/git/commits/max-receive6

and here on the list:

RFC: 
https://public-inbox.org/git/20160815195729.16826-1-chrisc...@tuxfamily.org/
v1: https://public-inbox.org/git/20160816081701.29949-1-chrisc...@tuxfamily.org/

Peff's initial patch is:

https://public-inbox.org/git/20150612182045.GA23698%40peff.net/

Diff with previous v1 version
~

diff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh
index b38d508..09e958f 100755
--- a/t/t5546-push-limits.sh
+++ b/t/t5546-push-limits.sh
@@ -11,11 +11,11 @@ test_expect_success 'create remote repository' '
 # When the limit is 1, `git receive-pack` will call `git index-pack`.
 # When the limit is 10, `git receive-pack` will call `git unpack-objects`.
 
-while read unpacklimit filesize filename
+while read unpacklimit filesize filename seed
 do
 
test_expect_success "create known-size ($filesize bytes) commit 
'$filename'" '
-   test-genrandom foo "$filesize" >"$filename" &&
+   test-genrandom "$seed" "$filesize" >"$filename" &&
git add "$filename" &&
test_commit "$filename"
'
@@ -35,8 +35,8 @@ do
'
 
 done <<\EOF
-1 1024 one-k-file
-10 2048 two-k-file
+1 1024 one-k-file foo
+10 1024 other-one-k-file bar
 EOF
 
 test_done
---

Christian Couder (1):
  unpack-objects: add --max-input-size= option

Jeff King (2):
  index-pack: add --max-input-size= option
  receive-pack: allow a maximum input size to be specified

 Documentation/config.txt |  5 +
 Documentation/git-index-pack.txt |  2 ++
 Documentation/git-receive-pack.txt   |  3 +++
 Documentation/git-unpack-objects.txt |  3 +++
 builtin/index-pack.c |  5 +
 builtin/receive-pack.c   | 12 +++
 builtin/unpack-objects.c |  7 ++
 t/t5546-push-limits.sh   | 42 
 8 files changed, 79 insertions(+)
 create mode 100755 t/t5546-push-limits.sh

-- 
2.10.0.rc0.3.geb1f4c9.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html