Re: [PATCH] dir: avoid allocation in fill_directory()

2017-02-08 Thread Brandon Williams
epend on prefix having a \0 at prefix_len then this will allow us to more easily find the bug and fix it. > > > > > /* Read the directory and prune it */ > > read_directory(dir, prefix, prefix_len, pathspec); > > > > - free(prefix); > > return prefix_len; > > } > -- > Duy -- Brandon Williams

Re: [PATCH 1/2] pathspec magic: add '^' as alias for '!'

2017-02-08 Thread Brandon Williams
s command: 'exclude' (mnemonic: '!') And the user may scratch their head for a second since they didn't supply the '!' character, but rather '^'. That being said I think it should be fine since the long name of the magic is also printed so the user should be able to figure out what's wrong. I also don't think there are any users of pathspecs which disallow exclude magic so this may not even be an issue. -- Brandon Williams

Re: [PATCH v3 00/27] Revamp the attribute system; another round

2017-02-09 Thread Brandon Williams
rs again > anyway. > > Thanks. > At least v3 gets the attribute system to a state where further improvements should be relatively easy to make. And now as long as each thread has a unique attr_check structure, multiple callers can exist inside the attribute system at the same time. There is still more work to be done on it though. Still my biggest complaint is the "direction" aspect of the system. I would love to also eliminate that as global state at some point though I'm not sure how at this point. -- Brandon Williams

Re: [PATCH 2/2] ls-files: move only kept cache entries in prune_cache()

2017-02-10 Thread Brandon Williams
(last - pos) * sizeof(struct cache_entry *)); > + active_nr = last - pos; > } > > /* > -- > 2.11.1 > Both these patches look good to me. -- Brandon Williams

Re: [RFC-PATCHv2] submodules: add a background story

2017-02-13 Thread Brandon Williams
I already have all the information about a submodule in the .gitmodules file, isn't it already initialized then? Maybe this state would be better named "(in)active" as a module that is interesting to a user is "active"? -- Brandon Williams

Re: [PATCH 1/7] grep: move thread initialization a little lower

2017-02-14 Thread Brandon Williams
lower (to right before we actually start > grepping), but I doubt it matters much in practice. Looks good. And yes I don't believe anything needs the thread initialization to happen earlier. -- Brandon Williams

Re: [PATCH 4/7] grep: re-order rev-parsing loop

2017-02-14 Thread Brandon Williams
object, arg, &list, oc.mode, > oc.path); This is much more readable! -- Brandon Williams

Re: [PATCH 5/7] grep: fix "--" rev/pathspec disambiguation

2017-02-14 Thread Brandon Williams
; > } > > - /* The rest are paths */ > + /* > + * Anything left over is presumed to be a path. But in the non-dashdash > + * "do what I mean" case, we verify and complain when that isn't true. > + */ -- Brandon Williams

Re: [PATCH 02/14] lib-submodule-update.sh: define tests for recursing into submodules

2017-02-15 Thread Brandon Williams
ubmodule_repo () { > git add sub1 && > git commit -m "Modify sub1" && > > + git checkout -b modify_sub1_recursively modify_sub1 && > + git -C sub1 checkout -b "add_nested_sub" && > + git -C sub1 submodule add --branch no_submodule ./. sub2 && I thought we were trying to avoid './.' when adding submodules? -- Brandon Williams

Re: [PATCH 07/14] update submodules: introduce is_interesting_submodule

2017-02-15 Thread Brandon Williams
tion. > + */ > +extern int submodules_interesting_for_update(void); > +extern int is_interesting_submodule(const struct cache_entry *ce); > extern void check_for_new_submodule_commits(unsigned char new_sha1[20]); > extern int fetch_populated_submodules(const struct argv_array *options, > const char *prefix, int command_line_option, > -- > 2.12.0.rc0.16.gd1691994b4.dirty > -- Brandon Williams

Re: [PATCH 12/15] unpack-trees: check if we can perform the operation for submodules

2017-02-16 Thread Brandon Williams
ou think it would makes sense to add in a call to 'submodule_free()' to clear the cache used to store the gitmodules config? -- Brandon Williams

Re: [PATCH] submodule.c: Add missing quotation marks

2017-02-17 Thread Brandon Williams
N_ERROR) > - die(_("could not run 'git status in submodule '%s'"), > + die(_("could not run 'git status' in submodule '%s'"), > path); > ret = -1; > } > -- > 2.11.1 > -- Brandon Williams

[PATCH v7 0/4] recursive support for ls-files

2016-10-07 Thread Brandon Williams
Few minor fixes pointed out Stefan Brandon Williams (4): git: make super-prefix option ls-files: optionally recurse into submodules ls-files: pass through safe options for --recurse-submodules ls-files: add pathspec matching for submodules Documentation/git-ls-files.txt | 7

[PATCH v7 2/4] ls-files: optionally recurse into submodules

2016-10-07 Thread Brandon Williams
nd to output or pathspec matching logic. Signed-off-by: Brandon Williams --- Documentation/git-ls-files.txt | 8 +- builtin/ls-files.c | 138 - git.c | 2 +- t/t3007-ls-files-recurse-submodules.sh

[PATCH v7 1/4] git: make super-prefix option

2016-10-07 Thread Brandon Williams
ontext to submodules about how they were invoked. This option is currently only allowed for builtins which support a super-prefix. Signed-off-by: Brandon Williams --- Documentation/git.txt | 6 ++ cache.h | 2 ++ environment.c | 13 + git.c

[PATCH v7 3/4] ls-files: pass through safe options for --recurse-submodules

2016-10-07 Thread Brandon Williams
Pass through some known-safe options when recursing into submodules. (--cached, -v, -t, -z, --debug, --eol) Signed-off-by: Brandon Williams --- builtin/ls-files.c | 30 +++--- t/t3007-ls-files-recurse-submodules.sh | 16 2 files

[PATCH v7 4/4] ls-files: add pathspec matching for submodules

2016-10-07 Thread Brandon Williams
More accurate matching will be done once inside the submodule. This is due to the superproject not knowing what files could exist in the submodule. Signed-off-by: Brandon Williams --- Documentation/git-ls-files.txt | 3 +- builtin/ls-files.c | 27 +++--

Re: [PATCH v7 0/4] recursive support for ls-files

2016-10-07 Thread Brandon Williams
On 10/07, Stefan Beller wrote: > On Fri, Oct 7, 2016 at 11:34 AM, Stefan Beller wrote: > > On Fri, Oct 7, 2016 at 11:18 AM, Brandon Williams wrote: > >> Few minor fixes pointed out Stefan > > > > The series itself looks good though. :) > > Thanks, > Ste

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

2016-10-11 Thread Brandon Williams
; 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

Re: [PATCH 17/28] attr: expose validity check for attribute names

2016-10-11 Thread Brandon Williams
|| ch == '.' || ch == '_' || > ('0' <= ch && ch <= '9') || > ('a' <= ch && ch <= 'z') || > ('A' <= ch && ch <= 'Z')) ) > - return -1; > + return 0; > } > - return 0; > + return -1; > +} Whats the reason behind returning -1 for a valid attr name vs 1? -- Brandon Williams

Re: [PATCH 17/28] attr: expose validity check for attribute names

2016-10-11 Thread Brandon Williams
On 10/11, Stefan Beller wrote: > On Tue, Oct 11, 2016 at 10:28 AM, Brandon Williams wrote: > > On 10/10, Stefan Beller wrote: > >> From: Junio C Hamano > >> -static int invalid_attr_name(const char *name, int namelen) > >> +int attr_name_va

Re: [PATCH 17/28] attr: expose validity check for attribute names

2016-10-11 Thread Brandon Williams
On 10/11, Stefan Beller wrote: > On Tue, Oct 11, 2016 at 11:40 AM, Brandon Williams wrote: > > > Wouldn't a +1 indicate that the attr name is valid while the 0 > > indicates that it is invalid? > > Right. > > > It looks to me like we are checking each >

[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 --- Documentation/git-submodule.txt | 4 +++- Documentation/gitmodules.txt

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

2016-10-19 Thread Brandon Williams
On 10/19, Junio C Hamano wrote: > Junio C Hamano writes: > > > Brandon Williams writes: > > > >> Update the documentaion for the the special value `.` to indicate that > >> it signifies that the tracking branch in the submodule should be the > >> s

[RFC PATCH 0/5] recursively grep across submodules

2016-10-27 Thread Brandon Williams
.git'. I'm going to spend some more time thinking about this problem and will address it as an additional patch in the series at a later time. As for the rest of the series, it should be ready for review or comments. Brandon Williams (5): submodules: add helper functions

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

2016-10-27 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 --- submodule.c | 39

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

2016-10-27 Thread Brandon Williams
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 --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --

[PATCH 4/5] grep: optionally recurse into submodules

2016-10-27 Thread Brandon Williams
ff-by: Brandon Williams --- Documentation/git-grep.txt | 5 + builtin/grep.c | 301 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 386 insertions(+), 21 dele

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

2016-10-27 Thread Brandon Williams
he command `git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams --- Documentation/git-grep.txt | 13 ++-- builtin/grep.c | 67 +++--- t/t7814-gr

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

2016-10-27 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 --- cache.h| 2 ++ con

Re: [RFC PATCH 0/5] recursively grep across submodules

2016-10-28 Thread Brandon Williams
On 10/27, Junio C Hamano wrote: > Brandon Williams writes: > > > As for the rest of the series, it should be ready for review or comments. > > Just a few brief comments, before reading the patches carefully. > > * It is somewhat surprising that [1/5] is even needed

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

2016-10-28 Thread Brandon Williams
On 10/27, Brandon Williams wrote: > diff --git a/tree-walk.c b/tree-walk.c > index 828f4356b..b3f996174 100644 > --- a/tree-walk.c > +++ b/tree-walk.c > @@ -999,10 +999,11 @@ static enum interesting do_match(const struct > name_entry *entry, >

[PATCH v2 0/6] recursively grep across submodules

2016-10-31 Thread Brandon Williams
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 to

[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 --- cache.h| 2 ++ con

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

2016-10-31 Thread Brandon Williams
ff-by: Brandon Williams --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 385 insertions(+), 21 dele

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

2016-10-31 Thread Brandon Williams
he searching of history from a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams --- builtin/grep.c | 18 + t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 55 insertio

[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 --- submodule.c | 39

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

2016-10-31 Thread Brandon Williams
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 --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --

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

2016-10-31 Thread Brandon Williams
he command `git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams --- Documentation/git-grep.txt | 13 +- builtin/grep.c | 83 +++--- t/t7814-grep-recurse-sub

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 wrote: > > +int is_submodule_checked_out(const char *path) > > +{ > > + int ret = 0; > > + struct strbuf buf = STRBUF_INIT; > > + > > + strbuf_addf(

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

2016-11-01 Thread Brandon Williams
thout > > being extern) > > Maybe I am old fashioned, but I'd feel better to see these with > explicit "extern" in front (check the older header files like > cache.h when you are in doubt what the project convention has been). I wouldn't consider 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 wrote: > > > > > +--recurse-submodules:: > > + Recursively search in each submodule that has been initialized and > > + checked out in the repository. > > + >

[PATCH] transport: add core.allowProtocol config option

2016-11-02 Thread Brandon Williams
a whitelist in their gitconfig. Signed-off-by: Brandon Williams --- 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 index 270

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

2016-11-02 Thread Brandon Williams
ts for this 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-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
asiest way to test is: > > > > 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
a whitelist in their gitconfig. Signed-off-by: Brandon Williams --- Documentation/config.txt| 8 Documentation/git.txt | 6 -- git-submodule.sh| 3 ++- t/lib-proto-disable.sh | 27 +++ t/t5815-submodule-protos.sh | 22 +++

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

2016-11-03 Thread Brandon Williams
: ${GIT_ALLOW_PROTOCOL=$(git var GIT_ALLOW_PROTOCOL)} > > > > 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
ssible hostile .gitmodules file such > that I am not aware of the network connection. 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

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

2016-11-03 Thread Brandon Williams
hese 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
we'd want to keep GIT_ALLOW_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

[PATCH v3] transport: add protocol policy config option

2016-11-04 Thread Brandon Williams
lly clone/fetch/pull 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 --- Documentation/config.txt | 25 +

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 Is there an acceptable way to give credit to Jeff for helping with this patch? -- 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 wrote: > > > On 11/04, Brandon Williams wrote: > > >> Signed-off-by: Brandon Williams > > > > > >

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

2016-11-07 Thread Brandon Williams
abled)" ' > > + 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-07 Thread Brandon Williams
. > > > > -# test 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

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

2016-11-07 Thread Brandon Williams
Based on a patch by Jeff King Signed-off-by: Brandon Williams --- Documentation/config.txt | 25 Documentation/git.txt| 21 --- git-submodule.sh | 12 ++-- t/lib-proto-disable.sh | 129 +-- t/t5509-

[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 --- 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..be88e9

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. > Becau

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

2016-11-07 Thread Brandon Williams
. So I could go either way. I'll add in another test for that, no reason not to test it. > > Squashable documentation suggestions are below. > Sounds good -- Brandon Williams

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

2016-11-07 Thread Brandon Williams
atch by Jeff King Signed-off-by: Brandon Williams --- Documentation/config.txt | 46 ++ Documentation/git.txt| 38 +--- git-submodule.sh | 12 ++-- t/lib-proto-disable.sh | 130 +-- t/t5509-

[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 --- t/lib-proto-disable.sh | 12 ++-- 1 file changed, 6 insert

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 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 --- cache.h| 2 ++ con

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

2016-11-11 Thread Brandon Williams
he command `git grep -e. -l --recurse-submodules HEAD` from: HEAD:file :sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams --- Documentation/git-grep.txt | 13 +- builtin/grep.c | 83 +++--- t/t7814-grep-recurse-sub

[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 --- submodule.c | 38

[PATCH v3 0/6] recursively grep across submodules

2016-11-11 Thread Brandon Williams
nal input would be appreciated! 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

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

2016-11-11 Thread Brandon Williams
he searching of history from a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams --- builtin/grep.c | 18 +++-- t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 57 insertio

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

2016-11-11 Thread Brandon Williams
ff-by: Brandon Williams --- Documentation/git-grep.txt | 5 + builtin/grep.c | 300 ++--- git.c | 2 +- t/t7814-grep-recurse-submodules.sh | 99 4 files changed, 385 insertions(+), 21 dele

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

2016-11-11 Thread Brandon Williams
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 --- grep.c | 16 +++- grep.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --

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 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 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 writes: > > > >>>>to: > >>>>HEAD:file > >>>>HEAD:sub/file > >>>> > >>>>Signed-off-by: Brandon Williams > >

[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 --- 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/t5531-deep-submodule-pu

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

2016-11-14 Thread Brandon Williams
ich perform 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.

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

2016-11-14 Thread Brandon Williams
onal check 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 --- s

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 v3 0/4] Speedup finding of unpushed submodules

2016-11-15 Thread Brandon Williams
urs. 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 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
modules > + * 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
/ > + if (!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 09/16] update submodules: add scheduling to update submodules

2016-11-15 Thread Brandon Williams
ules_config(); > + > + /* > + * NEEDSWORK: As submodule updates can potentially take some > + * time each and they do not overlap (i.e. no d/f conflicts; > + * this can be parallelized using the run_commands.h API. > + */ > + for (i = 0; i < scheduled_submodules_nr; i++) { > + struct scheduled_submodules_update_type *ssu = > + &scheduled_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 10/16] update submodules: is_submodule_checkout_safe

2016-11-15 Thread Brandon Williams
*path); > extern int ok_to_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
or_warn(const char *file) > > 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 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

[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): pus

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

2016-11-17 Thread Brandon Williams
onal check 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 --- s

[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 --- 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-push.sh index 19

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 wrote: > > > sha1_array_clear(&commits); > > - 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 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 > > 'origin/hv/submodule-not-yet-pus

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

2016-11-17 Thread Brandon Williams
sing threads=1. You can't 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 08/16] update submodules: add depopulate_submodule

2016-11-17 Thread Brandon Williams
dir", which can be given 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

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 wrote: > > + /* > > +* Add basename of parent project > > +* When performing grep on a object the filename is prefixed > > +* with the object's name: &

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

2016-11-18 Thread Brandon Williams
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 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 --- submodule.c | 38

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