Re: [PATCH v5 2/2] transport: add protocol policy config option

2016-11-08 Thread Brandon Williams
On 11/08, Jeff King wrote: > On Mon, Nov 07, 2016 at 01:51:02PM -0800, Brandon Williams wrote: > > > Previously the `GIT_ALLOW_PROTOCOL` environment variable was used to > > specify a whitelist of protocols to be used in clone/fetch/push > > commands. This patch intr

[PATCH v3] transport: add protocol policy config option

2016-11-04 Thread Brandon Williams
from untrusted repositories without user intervention can export `GIT_PROTOCOL_FROM_USER` with a value of '0' to prevent protocols configured to the `user` policy from being used. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 25 Documen

Re: [PATCH v3] transport: add protocol policy config option

2016-11-04 Thread Brandon Williams
On 11/04, Brandon Williams wrote: > Signed-off-by: Brandon Williams <bmw...@google.com> Is there an acceptable way to give credit to Jeff for helping with this patch? -- Brandon Williams

[PATCH v5 1/2] lib-proto-disable: variable name fix

2016-11-07 Thread Brandon Williams
The test_proto function assigns the positional parameters to named variables, but then still refers to "$desc" as "$1". Using $desc is more readable and less error-prone. Signed-off-by: Brandon Williams <bmw...@google.com> --- t/lib-proto-disable.sh | 12 +

[PATCH v4 2/2] transport: add protocol policy config option

2016-11-07 Thread Brandon Williams
<p...@peff.net> Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 25 Documentation/git.txt| 21 --- git-submodule.sh | 12 ++-- t/lib-proto-disable.sh | 129 ++

[PATCH v4 1/2] lib-proto-disable: variable name fix

2016-11-07 Thread Brandon Williams
Small fix to use '$desc' instead of '$1' in lib-proto-disable.sh. Signed-off-by: Brandon Williams <bmw...@google.com> --- t/lib-proto-disable.sh | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/lib-proto-disable.sh b/t/lib-proto-disable.sh index b0917d9..b

Re: [PATCH v3] transport: add protocol policy config option

2016-11-07 Thread Brandon Williams
cloning a particular protocol > > -# $1 - description of the protocol > > -# $2 - machine-readable name of the protocol > > -# $3 - the URL to try cloning > > -test_proto () { > > +# Test clone/fetch/push with GIT_ALLOW_PROTOCOL whitelist > > +test_whitelist () { > > desc=$1 > > proto=$2 > > url=$3 > > > > - test_expect_success "clone $1 (enabled)" ' > > + test_expect_success "clone $desc (enabled)" ' > > Yeah, this should have been $desc all along. It makes the diff really > noisy, though. Should it be split out into a preparatory change? I'll pull it out to make the patch a bit cleaner. -- Brandon Williams

Re: [PATCH v3] transport: add protocol policy config option

2016-11-07 Thread Brandon Williams
> > + rm -rf tmp.git && > > + test_must_fail git clone --bare "$url" tmp.git > > + ' > > > I could not spot a test for GIT_ALLOW_PROTOCOL overriding > any protocol*allow policy. Is that also worth testing? (for > backwards compatibility of tools that make use of GIT_ALLOW_PROTOCOL > but the user already setup a policy. I can add in one quick test for that. -- Brandon Williams

Re: [PATCH v3] transport: add protocol policy config option

2016-11-04 Thread Brandon Williams
On 11/04, Jeff King wrote: > On Fri, Nov 04, 2016 at 02:35:57PM -0700, Stefan Beller wrote: > > > On Fri, Nov 4, 2016 at 1:58 PM, Brandon Williams <bmw...@google.com> wrote: > > > On 11/04, Brandon Williams wrote: > > >> Signed-off-

Re: [PATCH v4 1/2] lib-proto-disable: variable name fix

2016-11-07 Thread Brandon Williams
On 11/07, Jeff King wrote: > On Mon, Nov 07, 2016 at 11:35:22AM -0800, Brandon Williams wrote: > > > Small fix to use '$desc' instead of '$1' in lib-proto-disable.sh. > > Even for a trivial fixup like this, I think it's good to say why. > Because what seems trivial and

[PATCH] submodules: update documentaion for submodule branches

2016-10-19 Thread Brandon Williams
Update the documentaion for the the special value `.` to indicate that it signifies that the tracking branch in the submodule should be the same as the current branch in the superproject. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-submodule.t

Re: [PATCH] submodules: update documentaion for submodule branches

2016-10-19 Thread Brandon Williams
On 10/19, Junio C Hamano wrote: > Junio C Hamano <gits...@pobox.com> writes: > > > Brandon Williams <bmw...@google.com> writes: > > > >> Update the documentaion for the the special value `.` to indicate that > >> it signifies that the tracking

[PATCH 0/2] bug fix with push --dry-run and submodules

2016-11-14 Thread Brandon Williams
the submodule pushes during a dry-run. This series is based against 'origin/hv/submodule-not-yet-pushed-fix' Brandon Williams (2): push: --dry-run updates submodules when --recurse-submodules=on-demand push: fix --dry-run to not push submodules submodule.c| 13

[PATCH 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand

2016-11-14 Thread Brandon Williams
as a dry-run. This is a bug and not the intended behaviour of a dry-run. Signed-off-by: Brandon Williams <bmw...@google.com> --- t/t5531-deep-submodule-push.sh | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/t5531-deep-submodule-push.sh b/t/t553

[PATCH 2/2] push: fix --dry-run to not push submodules

2016-11-14 Thread Brandon Williams
for unpushed submodules is skipped during a dry-run when --recurse-submodules=on-demand. The check is skipped because the submodule pushes were performed as dry-runs and this check would always fail as the submodules would still need to be pushed. Signed-off-by: Brandon Williams <

Re: [PATCH v3 6/6] grep: search history of moved submodules

2016-11-14 Thread Brandon Williams
On 11/11, Stefan Beller wrote: > On Fri, Nov 11, 2016 at 3:51 PM, Brandon Williams <bmw...@google.com> wrote: > > > + > > + rm -rf parent sub > > This line sounds like a perfect candidate for "test_when_finished" > at the beginning of the test K will do. -- Brandon Williams

Re: [PATCH v4 5/6] grep: enable recurse-submodules to work on objects

2016-11-21 Thread Brandon Williams
On 11/18, Brandon Williams wrote: > Also, in order to use the tree_entry_interesting code it looks like I'll > either have to pipe through a flag saying 'yes i want to match against > submodules' like I did for the other pathspec codepath. Either that or > add functionalit

Re: [PATCHv2 2/3] submodule-config: rename commit_sha1 to commit_or_tree

2016-11-21 Thread Brandon Williams
On 11/21, Stefan Beller wrote: > On Mon, Nov 21, 2016 at 4:11 PM, Brandon Williams <bmw...@google.com> wrote: > > On 11/21, Stefan Beller wrote: > >> > >> switch (lookup_type) { > >> @@ -448,7 +448,8 @@ static const struct submodule *confi

Re: [PATCH 3/3] submodule--helper: add intern-git-dir function

2016-11-21 Thread Brandon Williams
test_commit -C sub2 first && > + git add sub2 && > + git commit -m superproject > +' > + > +test_expect_success 'intern the git dir fails for incomplete submodules' ' > + test_must_fail git submodule interngitdirs && > + # check that we did not break the repository: > + git status > +' > + > +test_done > + Could we add a test which has nested submodules that need to be migrated? Hopfully its just as easy as adding the test :) -- Brandon Williams

Re: [PATCHv2 3/3] submodule-config: clarify parsing of null_sha1 element

2016-11-21 Thread Brandon Williams
> contains > +the local configuration of a submodule (e.g. consolidated values from local > git > configuration and the .gitmodules file in the worktree). > > For an example usage see test-submodule-config.c. > -- > 2.11.0.rc2.18.g0126045.dirty > -- Brandon Williams

Re: [PATCHv2 2/3] submodule-config: rename commit_sha1 to commit_or_tree

2016-11-21 Thread Brandon Williams
parameter.commit_sha1 = commit_sha1; > + // todo: get the actual tree here: s/todo/TODO Makes it more clear that this is a TODO -- Brandon Williams

Re: [PATCHv4 0/3] submodule-config: clarify/cleanup docs and header

2016-11-22 Thread Brandon Williams
Series looks good to me. At least the issues I raised are fixed. -- Brandon Williams

Re: [PATCH v5 5/6] grep: enable recurse-submodules to work on objects

2016-11-22 Thread Brandon Williams
On 11/22, Brandon Williams wrote: > On 11/22, Junio C Hamano wrote: > > Brandon Williams <bmw...@google.com> writes: > > > > > diff --git a/tree-walk.c b/tree-walk.c > > > index 828f435..ff77605 100644 > > > --- a/tree-walk.c > > > +

Re: [PATCH 31/35] pathspec: allow querying for attributes

2016-11-28 Thread Brandon Williams
if (!pathspec->items[i].attr_match_nr) > + continue; > + for (j = 0; j < pathspec->items[j].attr_match_nr; j++) This looks like a bug. Should it be: for (j = 0; j < pathspec->items[i].attr_match_nr; j++) where items[j] -> items[i] -- Brandon Williams

Re: [PATCH 31/35] pathspec: allow querying for attributes

2016-11-28 Thread Brandon Williams
+ die(_("Only one 'attr:' specification is allowed.")); > + > + argv_array_clear(); > + string_list_clear(, 0); > + return; > +} Unnecessary return statement, maybe you want to remove it? -- Brandon Williams

Re: [PATCH 31/35] pathspec: allow querying for attributes

2016-11-28 Thread Brandon Williams
so want to add logic like this to the 'copy_pathspec' function so that when a pathspec struct is copied, the destination also has ownership of its own attribute items. -- Brandon Williams

Re: What's cooking in git.git (Nov 2016, #06; Mon, 28)

2016-11-28 Thread Brandon Williams
n particular are you seeing issues with? I can't see any issues running it locally. -- Brandon Williams

Re: [PATCH v5 5/6] grep: enable recurse-submodules to work on objects

2016-11-22 Thread Brandon Williams
On 11/22, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > >> > So this change may have an impact on "git ls-tree -r" with pathspec; > >> > I offhand do not know if that impact is undesirable or not. A test > >&

Re: [PATCH v5 5/6] grep: enable recurse-submodules to work on objects

2016-11-22 Thread Brandon Williams
On 11/22, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > diff --git a/tree-walk.c b/tree-walk.c > > index 828f435..ff77605 100644 > > --- a/tree-walk.c > > +++ b/tree-walk.c > > @@ -1004,6 +1004,19 @@ static enum interesting do

Re: [PATCHv3 3/3] submodule-config: clarify parsing of null_sha1 element

2016-11-22 Thread Brandon Williams
ule (e.g. consolidated values from local git > > configuration and the .gitmodules file in the worktree). > > > > For an example usage see test-submodule-config.c. I brought this up in v2, he must have just missed it for v3. -- Brandon Williams

[PATCH v5 4/6] grep: optionally recurse into submodules

2016-11-22 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 386 inse

[PATCH v5 6/6] grep: search history of moved submodules

2016-11-22 Thread Brandon Williams
a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/grep.c | 20 +-- t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 59 insertions(+), 2 del

[PATCH v5 5/6] grep: enable recurse-submodules to work on objects

2016-11-22 Thread Brandon Williams
`git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 13 - builtin/grep.c | 76 --- t/t781

Re: [PATCH v2 2/2] push: fix --dry-run to not push submodules

2016-11-22 Thread Brandon Williams
On 11/22, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > On 11/17, Stefan Beller wrote: > >> On Thu, Nov 17, 2016 at 10:46 AM, Brandon Williams <bmw...@google.com> > >> wrote: > >> >

[PATCH v5 3/6] grep: add submodules as a grep source type

2016-11-22 Thread Brandon Williams
of the submodule to be grep'd). If the identifier is a SHA1 then we want to fall through to the `GREP_SOURCE_SHA1` case to handle the copying of the SHA1. Signed-off-by: Brandon Williams <bmw...@google.com> --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 de

[PATCH v5 0/6] recursively grep across submodules

2016-11-22 Thread Brandon Williams
Major change in v5 is to use tree_is_interesting api instead of the vanilla pathspec code for submodules. This is to fix the issue in the last seires where I mix the two types. More tests were also added to ensure that the changes to the pathspec code functioned properly. Brandon Williams (6

[PATCH v5 1/6] submodules: add helper functions to determine presence of submodules

2016-11-22 Thread Brandon Williams
Add two helper functions to submodules.c. `is_submodule_initialized()` checks if a submodule has been initialized at a given path and `is_submodule_populated()` check if a submodule has been checked out at a given path. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.

[PATCH v5 2/6] submodules: load gitmodules file from commit sha1

2016-11-22 Thread Brandon Williams
teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. Signed-off-by: Brandon Williams <bmw...@google.com> --- cache.h| 2 ++ co

Re: [PATCH v3 0/4] Speedup finding of unpushed submodules

2016-11-15 Thread Brandon Williams
ding a series on top of yours. I don't think there should be too much I'll have to change with my series, I'll just rebase against these changes once Junio updates his branch. If you want to take a look at my series its here: https://public-inbox.org/git/1479172735-698-1-git-send-email-bmw...@google.com/ Thanks for the heads up Stefan. -- Brandon Williams

Re: [PATCH 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand

2016-11-15 Thread Brandon Williams
On 11/15, Johannes Sixt wrote: > Am 15.11.2016 um 02:18 schrieb Brandon Williams: > >diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh > >index 198ce84..e6ccc30 100755 > >--- a/t/t5531-deep-submodule-push.sh > >+++ b/t/t5531-deep-submodule-p

Re: [PATCH v4 5/6] grep: enable recurse-submodules to work on objects

2016-11-18 Thread Brandon Williams
On 11/18, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > @@ -671,12 +707,29 @@ static int grep_tree(struct grep_opt *opt, const > > struct pathspec *pathspec, > > enum interesting match = entry_not_interesting; > >

Re: [PATCH 08/16] update submodules: add depopulate_submodule

2016-11-18 Thread Brandon Williams
name); > + > + if (rename(old_git_dir, new_git_dir) < 0) > + die_errno(_("Could not migrate git directory from %s to %s"), > + old_git_dir, new_git_dir); > + > + connect_work_tree_and_git_dir(path, new_git_dir); > +out: > + free(old_git_dir); > +} > diff --git a/submodule.h b/submodule.h > index aac202c..143ec18 100644 > --- a/submodule.h > +++ b/submodule.h > @@ -90,5 +90,6 @@ extern int parallel_submodules(void); > * retaining any config in the environment. > */ > extern void prepare_submodule_repo_env(struct argv_array *out); > +extern void migrate_submodule_gitdir(const char *path); > > #endif -- Brandon Williams

[PATCH v4 4/6] grep: optionally recurse into submodules

2016-11-18 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 385 inse

[PATCH v4 2/6] submodules: load gitmodules file from commit sha1

2016-11-18 Thread Brandon Williams
teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. Signed-off-by: Brandon Williams <bmw...@google.com> --- cache.h| 2 ++ co

[PATCH v4 6/6] grep: search history of moved submodules

2016-11-18 Thread Brandon Williams
a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/grep.c | 20 +-- t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 59 insertions(+), 2 del

[PATCH v4 5/6] grep: enable recurse-submodules to work on objects

2016-11-18 Thread Brandon Williams
`git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 13 +- builtin/grep.c | 83 +++

[PATCH v4 1/6] submodules: add helper functions to determine presence of submodules

2016-11-18 Thread Brandon Williams
Add two helper functions to submodules.c. `is_submodule_initialized()` checks if a submodule has been initialized at a given path and `is_submodule_populated()` check if a submodule has been checked out at a given path. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.

[PATCH v4 0/6] recursively grep across submodules

2016-11-18 Thread Brandon Williams
pass --threads=%d in order to limit threads to child proccess. Brandon Williams (6): submodules: add helper functions to determine presence of submodules submodules: load gitmodules file from commit sha1 grep: add submodules as a grep source type grep: optionally recurse into submodules

[PATCH v4 3/6] grep: add submodules as a grep source type

2016-11-18 Thread Brandon Williams
of the submodule to be grep'd). If the identifier is a SHA1 then we want to fall through to the `GREP_SOURCE_SHA1` case to handle the copying of the SHA1. Signed-off-by: Brandon Williams <bmw...@google.com> --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 de

Re: [PATCH v4 3/6] grep: add submodules as a grep source type

2016-11-18 Thread Brandon Williams
On 11/18, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > diff --git a/grep.h b/grep.h > > index 5856a23..267534c 100644 > > --- a/grep.h > > +++ b/grep.h > > @@ -161,6 +161,7 @@ struct grep_source { > > GR

Re: [PATCH v4 4/6] grep: optionally recurse into submodules

2016-11-18 Thread Brandon Williams
On 11/18, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > +static int grep_cache(struct grep_opt *opt, const struct pathspec > > *pathspec, > > + int cached) > > { > > int hit = 0; > >

Re: [PATCH v3 4/6] grep: optionally recurse into submodules

2016-11-17 Thread Brandon Williams
pass threads=0 in some cases due to the default "oh look threads==0, looks like we should use 8!" case. > > > + > > + git grep -e "bar" --and -e "foo" --recurse-submodules > actual && > > nit here and in the tests below: > We prefer to have no white space between > and the file piped to. I'll fix that up everywhere. -- Brandon Williams

Re: [PATCH v2 2/2] push: fix --dry-run to not push submodules

2016-11-17 Thread Brandon Williams
On 11/17, Stefan Beller wrote: > On Thu, Nov 17, 2016 at 10:46 AM, Brandon Williams <bmw...@google.com> wrote: > > > sha1_array_clear(); > > - die("Failed to push all needed > > submodules!");

Re: [PATCH v2 0/2] bug fix with push --dry-run and submodules

2016-11-17 Thread Brandon Williams
On 11/17, Stefan Beller wrote: > On Thu, Nov 17, 2016 at 10:46 AM, Brandon Williams <bmw...@google.com> wrote: > > v2 of this series is just a small cleanup of removing a nested sub-shell > > from a > > test and rebasing on the latest version of > > 'origi

[PATCH v2 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand

2016-11-17 Thread Brandon Williams
as a dry-run. This is a bug and not the intended behaviour of a dry-run. Signed-off-by: Brandon Williams <bmw...@google.com> --- t/t5531-deep-submodule-push.sh | 24 1 file changed, 24 insertions(+) diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-p

[PATCH v2 0/2] bug fix with push --dry-run and submodules

2016-11-17 Thread Brandon Williams
v2 of this series is just a small cleanup of removing a nested sub-shell from a test and rebasing on the latest version of 'origin/hv/submodule-not-yet-pushed-fix' As stated above this series is based on 'origin/hv/submodule-not-yet-pushed-fix' Brandon Williams (2): push: --dry-run updates

[PATCH v2 2/2] push: fix --dry-run to not push submodules

2016-11-17 Thread Brandon Williams
for unpushed submodules is skipped during a dry-run when --recurse-submodules=on-demand. The check is skipped because the submodule pushes were performed as dry-runs and this check would always fail as the submodules would still need to be pushed. Signed-off-by: Brandon Williams <

Re: [PATCH v3 5/6] grep: enable recurse-submodules to work on objects

2016-11-17 Thread Brandon Williams
On 11/15, Stefan Beller wrote: > On Fri, Nov 11, 2016 at 3:51 PM, Brandon Williams <bmw...@google.com> wrote: > > + /* > > +* Add basename of parent project > > +* When performing grep on a object the filename is prefixed > > +* w

Re: [PATCH 08/16] update submodules: add depopulate_submodule

2016-11-17 Thread Brandon Williams
iven as a helpful hint > or even run here first. That would be a good idea, does that functionality already exist in one form or another? I'm assuming it must since git update does just that when cloning a submodule. -- Brandon Williams

[PATCH v3 0/6] recursively grep across submodules

2016-11-11 Thread Brandon Williams
! Thanks! Brandon Brandon Williams (6): submodules: add helper functions to determine presence of submodules submodules: load gitmodules file from commit sha1 grep: add submodules as a grep source type grep: optionally recurse into submodules grep: enable recurse-submodules to work

[PATCH v3 6/6] grep: search history of moved submodules

2016-11-11 Thread Brandon Williams
a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/grep.c | 18 +++-- t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 57 insertions(+), 2 del

[PATCH v3 1/6] submodules: add helper functions to determine presence of submodules

2016-11-11 Thread Brandon Williams
Add two helper functions to submodules.c. `is_submodule_initialized()` checks if a submodule has been initialized at a given path and `is_submodule_populated()` check if a submodule has been checked out at a given path. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.

[PATCH v3 5/6] grep: enable recurse-submodules to work on objects

2016-11-11 Thread Brandon Williams
`git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 13 +- builtin/grep.c | 83 +++--- t/t781

[PATCH v3 2/6] submodules: load gitmodules file from commit sha1

2016-11-11 Thread Brandon Williams
teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. Signed-off-by: Brandon Williams <bmw...@google.com> --- cache.h| 2 ++ co

[PATCH v3 4/6] grep: optionally recurse into submodules

2016-11-11 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 385 inse

[PATCH v3 3/6] grep: add submodules as a grep source type

2016-11-11 Thread Brandon Williams
of the submodule to be grep'd). If the identifier is a SHA1 then we want to fall through to the `GREP_SOURCE_SHA1` case to handle the copying of the SHA1. Signed-off-by: Brandon Williams <bmw...@google.com> --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 de

Re: [PATCH 04/16] update submodules: add is_submodule_populated

2016-11-15 Thread Brandon Williams
On 11/15, Stefan Beller wrote: > This is nearly same as Brandon sent out. > (First patch of origin/bw/grep-recurse-submodules, > will drop this patch once Brandons series is stable > enough to build on). I would be thrilled to see more reviews on that series :D -- Brandon Williams

Re: [PATCH 07/16] update submodules: introduce submodule_is_interesting

2016-11-15 Thread Brandon Williams
> submodules > + * or the submodule is marked uninteresting by being not initialized. > + */ The first sentence seems a bit awkward. It seems like its worded as a question, maybe drop the 'do'? -- Brandon Williams

Re: [PATCH 08/16] update submodules: add depopulate_submodule

2016-11-15 Thread Brandon Williams
(!submodule_uses_gitfile(path)) { > + warning(_("cannot remove submodule '%s' because it (or one of " > + "its nested submodules) uses a .git directory"), > + path); > + ret = -1; > + goto out; > + } > + > + remove_subtree_or_die(path); > + > +out: > + free(dot_git); > + return ret; > +} -- Brandon Williams

Re: [PATCH 14/16] checkout: recurse into submodules if asked to

2016-11-15 Thread Brandon Williams
; + > + return 0; > +} I assume it is ok to always return 0 from this function? Also, I know we don't like having braces on single statement if's but it is a bit hard to read that multi-line statement without braces. But that's just my opinion :) -- Brandon Williams

Re: [PATCH 10/16] update submodules: is_submodule_checkout_safe

2016-11-15 Thread Brandon Williams
_remove_submodule(const char *path); > +extern int is_submodule_checkout_safe(const char *path, > + const struct object_id *oid); > extern int merge_submodule(unsigned char result[20], const char *path, > const unsigned char base[20], > const unsigned char a[20], > -- > 2.10.1.469.g00a8914 > -- Brandon Williams

Re: [PATCH 11/16] teach unpack_trees() to remove submodule contents

2016-11-15 Thread Brandon Williams
e) > > int rmdir_or_warn(const char *file) > { > + if (submodule_is_interesting(file, null_sha1) > + && depopulate_submodule(file)) > + return -1; > return warn_if_unremovable("rmdir", file, rmdir(file)); > } It seems weird to me that rmdir is doing checks to see if the file being removed is a submodule. Shouldn't those checks have occurred before calling rmdir? -- Brandon Williams

Re: [PATCH 13/16] submodule: teach unpack_trees() to update submodules

2016-11-15 Thread Brandon Williams
* new is not a submodule any more, so only > + * care if we care: > + */ > + if (submodule_is_interesting(old->name, > null_sha1) > + && ok_to_remove_submodule(old->name)) > + return 0; and here -- Brandon Williams

Re: [PATCH 09/16] update submodules: add scheduling to update submodules

2016-11-15 Thread Brandon Williams
he run_commands.h API. > + */ > + for (i = 0; i < scheduled_submodules_nr; i++) { > + struct scheduled_submodules_update_type *ssu = > + _submodules[i]; > + > + if (submodule_is_interesting(ssu->path, null_sha1)) > + update_submodule(ssu->path, ssu->oid, > + force, ssu->is_new); > + } > + > + scheduled_submodules_nr = 0; > + return 0; > +} nit: organization wise it makes more sense to me to have the 'update_submodule' helper function be located more closely to the 'update_submodules' function. -- Brandon Williams

Re: [PATCH v3 5/6] grep: enable recurse-submodules to work on objects

2016-11-14 Thread Brandon Williams
On 11/14, Jonathan Tan wrote: > On 11/14/2016 10:56 AM, Junio C Hamano wrote: > >Jonathan Tan <jonathanta...@google.com> writes: > > > >>>>to: > >>>>HEAD:file > >>>>HEAD:sub/file > >>>> > >>>>Signed-off

[PATCH v2 2/6] submodules: load gitmodules file from commit sha1

2016-10-31 Thread Brandon Williams
Teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. Signed-off-by: Brandon Williams <bmw...@google.com> --- cache.h| 2 ++ co

[PATCH v2 4/6] grep: optionally recurse into submodules

2016-10-31 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 385 inse

[PATCH v2 6/6] grep: search history of moved submodules

2016-10-31 Thread Brandon Williams
a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/grep.c | 18 + t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 55 insertions(+), 4 del

[PATCH v2 3/6] grep: add submodules as a grep source type

2016-10-31 Thread Brandon Williams
of the submodule to be grep'd). If the identifier is a SHA1 then we want to fall through to the `GREP_SOURCE_SHA1` case to handle the copying of the SHA1. Signed-off-by: Brandon Williams <bmw...@google.com> --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 de

[PATCH v2 5/6] grep: enable recurse-submodules to work on objects

2016-10-31 Thread Brandon Williams
`git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 13 +- builtin/grep.c | 83 +++--- t/t781

[PATCH v2 1/6] submodules: add helper functions to determine presence of submodules

2016-10-31 Thread Brandon Williams
Add two helper functions to submodules.c. `is_submodule_initialized()` checks if a submodule has been initialized at a given path and `is_submodule_checked_out()` check if a submodule has been checked out at a given path. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.

[PATCH v2 0/6] recursively grep across submodules

2016-10-31 Thread Brandon Williams
that was breaking with v1 of the series. Brandon Williams (6): submodules: add helper functions to determine presence of submodules submodules: load gitmodules file from commit sha1 grep: add submodules as a grep source type grep: optionally recurse into submodules grep: enable recurse-submodules

Re: [PATCH v2 1/6] submodules: add helper functions to determine presence of submodules

2016-11-01 Thread Brandon Williams
On 10/31, Stefan Beller wrote: > On Mon, Oct 31, 2016 at 3:38 PM, Brandon Williams <bmw...@google.com> wrote: > > +int is_submodule_checked_out(const char *path) > > +{ > > + int ret = 0; > > + struct strbuf buf = STRBUF_INIT; > > + &g

Re: [PATCH v2 1/6] submodules: add helper functions to determine presence of submodules

2016-11-01 Thread Brandon Williams
r that old fashion as I'm fairly new to all this and I also prefer the explicit "extern" :P -- Brandon Williams

Re: [PATCH v2 4/6] grep: optionally recurse into submodules

2016-11-01 Thread Brandon Williams
On 11/01, Stefan Beller wrote: > On Mon, Oct 31, 2016 at 3:38 PM, Brandon Williams <bmw...@google.com> wrote: > > > > > +--recurse-submodules:: > > + Recursively search in each submodule that has been initialized and > > + checked out in the repos

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
s that could be extended? (Otherwise we'd > maybe want to add a test for both the regular case as well as a forbidden > submodule?) > I can write a couple tests for a v2 of the patch. -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
and it would just work. Other tools could do the same, with a > > fallback to the current default until new enough git is in widespread > > use. > > ...some automated way to say "is this protocol supported"? I think it is > not just "give me ALLOW_PROTOCOL" anymore, though, but "apply your rules > to this protocol, and tell me if it is supported". I agree, if we do add different states to a protocol then we couldn't simply ask for a whitelist/blacklist of protocols anymore since its more of a graylist :) (if such a thing exits). -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
onnection. This is still a gray area to me. I think that if we have a whitelist of protocols then it should be a true whitelist and not have some means of going around it. It just seems like something that could be exploited. -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
On 11/03, Jeff King wrote: > On Thu, Nov 03, 2016 at 10:51:31AM -0700, Brandon Williams wrote: > > > > > I don't know if I'm sold on a 'user' state just yet, perhaps that's just > > > > because I view a whitelist or blacklist as well black and white and >

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
se subcommands set a variable indicating they aren't coming from the user and the deafult state (no var set) is a user run command? -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
OW_PROTOCOL for the truly > paranoid (though we should keep it indefinitely either way for backwards > compatibility). > > Do you have interest in picking this up and running with it? Yep! Thanks for the help in shaping this. -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-03 Thread Brandon Williams
On 11/03, Jeff King wrote: > On Thu, Nov 03, 2016 at 11:45:38AM -0700, Brandon Williams wrote: > > > On 11/03, Jeff King wrote: > > > > > > So this seems like a reasonable direction to me. It obviously needs > > > documentation and tests. Arguably there s

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
On 11/02, Jeff King wrote: > On Wed, Nov 02, 2016 at 03:20:47PM -0700, Brandon Williams wrote: > > > Add configuration option 'core.allowProtocol' to allow users to create a > > whitelist of allowed protocols for fetch/push/clone in their gitconfig. > > > >

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
t be worth fixing both places (or possibly just fixing the > original and phrasing this one as "If GIT_ALLOW_PROTOCOL is not set, use > this as the default value; see git(1) for details"). > > -Peff haha K I'll fix the original as well. -- Brandon Williams

Re: [PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
; git -c core.allowProtocol fetch > > > > which seems to segfault for me with this patch. > > what is the desired behavior when a user provides a config in a way that > isn't intended? oh...I can just drop in git_config_get_string_const() instead. -- Brandon Williams

[PATCH v2] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
in their gitconfig. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt| 8 Documentation/git.txt | 6 -- git-submodule.sh| 3 ++- t/lib-proto-disable.sh | 27 +++ t/t5815-submodule-protos.s

[PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
in their gitconfig. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 9 + git-submodule.sh | 3 ++- transport.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt

Re: [PATCH 11/28] attr: (re)introduce git_check_attr() and struct git_attr_check

2016-10-11 Thread Brandon Williams
s the word 'intern' here mean internalize? It took me a few reads to stop picturing college students running around an office :) -- Brandon Williams

Re: [PATCH 26/28] attr: make git_attr_counted static

2016-10-11 Thread Brandon Williams
On 10/10, Stefan Beller wrote: > It's not used outside the attr code, so let's keep it private. > > Change-Id: I0d15e0f2ea944b31d68b9cf1a4edecac0ca2170d Looks like you forgot to remove this :) -- Brandon Williams

Re: [PATCH 28/28] attr: convert to new threadsafe API

2016-10-11 Thread Brandon Williams
On 10/10, Stefan Beller wrote: > be initalized once as that part will be read only after its initialized > initialisation, the answer may be different for each path. should this be the US spelling 'initialization'? -- Brandon Williams

<    1   2   3   4   5   6   7   8   9   10   >