[PATCH 07/17] mv: small code cleanup

2016-12-06 Thread Brandon Williams
Now that the call to 'parse_pathspec()' doesn't modify the passed in const char **array there isn't a need to duplicate the pathspec element prior to freeing the intermediate strings. This small cleanup just makes the code a bit easier to read. Signed-off-by: Brandon William

[PATCH 13/17] pathspec: create parse_long_magic function

2016-12-06 Thread Brandon Williams
Factor out the logic responsible for parsing long magic into its own function. As well as hoist the prefix check logic outside of the inner loop as there isn't anything that needs to be done after matching "prefix:". Signed-off-by: Brandon Williams ---

[PATCH 05/17] pathspec: remove the deprecated get_pathspec function

2016-12-06 Thread Brandon Williams
he old functionality of modifying the const char **argv array that was passed into parse_pathspec. Instead the constructed 'match' string (which is a pathspec element with the prefix prepended) is only stored in its corresponding pathspec_item entry. Signed-off-by: Brandon Williams --

[PATCH 12/17] pathspec: create parse_short_magic function

2016-12-06 Thread Brandon Williams
Factor out the logic responsible for parsing short magic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/pathspec.c index 08e76f6

[PATCH 11/17] pathspec: factor global magic into its own function

2016-12-06 Thread Brandon Williams
Create helper functions to read the global magic environment variables in additon to factoring out the global magic gathering logic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 120 + 1 file changed, 74

[PATCH 15/17] pathspec: create strip submodule slash helpers

2016-12-06 Thread Brandon Williams
Factor out the logic responsible for stripping the trailing slash on pathspecs referencing submodules into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 68 ++ 1 file changed, 42 insertions(+), 26 deletions

[PATCH 14/17] pathspec: create parse_element_magic helper

2016-12-06 Thread Brandon Williams
Factor out the logic responsible for the magic in a pathspec element into its own function. Also avoid calling into the parsing functions when `PATHSPEC_LITERAL_PATH` is specified since it causes magic to be ignored and all paths to be treated as literals. Signed-off-by: Brandon Williams

[PATCH 08/17] pathspec: remove unused variable from unsupported_magic

2016-12-06 Thread Brandon Williams
Removed unused variable 'n' from the 'unsupported_magic()' function. Signed-off-by: Brandon Williams --- pathspec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pathspec.c b/pathspec.c index 8f367f0..ec0d590 100644 --- a/pathspec.c +++ b/pathspe

[PATCH 16/17] pathspec: small readability changes

2016-12-06 Thread Brandon Williams
A few small changes to improve readability. This is done by grouping related assignments, adding blank lines, ensuring lines are <80 characters, etc. Signed-off-by: Brandon Williams --- pathspec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pathspec.

[PATCH 17/17] pathspec: remove outdated comment

2016-12-06 Thread Brandon Williams
Remove part of the function header comment to prefix_pathspec as it is no longer relevant. Signed-off-by: Brandon Williams --- pathspec.c | 9 - 1 file changed, 9 deletions(-) diff --git a/pathspec.c b/pathspec.c index 8a07b02..66db257 100644 --- a/pathspec.c +++ b/pathspec.c

Re: [PATCH v7 4/4] transport: add from_user parameter to is_transport_allowed

2016-12-06 Thread Brandon Williams
mented could not cause security regressions unless > you use the new feature (IOW, we still respect the whitelist environment > exactly as before). Either way let me know if there is something I need to do. -- Brandon Williams

Re: [PATCH 10/17] pathspec: simpler logic to prefix original pathspec elements

2016-12-06 Thread Brandon Williams
On 12/06, Stefan Beller wrote: > On Tue, Dec 6, 2016 at 1:51 PM, Brandon Williams wrote: > > > struct strbuf sb = STRBUF_INIT; > > - if (prefixlen && !literal_global) { > > - /* Preserve the actual pr

Re: [PATCH] real_path: make real_path thread-safe

2016-12-06 Thread Brandon Williams
On 12/06, Junio C Hamano wrote: > Brandon Williams writes: > > > +/* removes the last path component from 'path' except if 'path' is root */ > > +static void strip_last_component(struct strbuf *path) > > +{ > > + if (path->len > 1) { &

Re: [PATCH] real_path: make real_path thread-safe

2016-12-07 Thread Brandon Williams
t; > must be converted into > > \\SEFVER\SHARE\DIR1 > > Additional questions that may be interesting are: > > //A/B/../Cis it //A/C? is it an error? > //A/B/../../C/D is it //C/D? is it an error? > Also is //.. the same as //? I would assume so since /.. is / -- Brandon Williams

Re: [PATCH] real_path: make real_path thread-safe

2016-12-07 Thread Brandon Williams
On 12/07, Johannes Sixt wrote: > Am 07.12.2016 um 01:10 schrieb Brandon Williams: > >This function should accept both absolute and relative paths, which > >means it should probably accept "C:\My Files". I wasn't thinking about > >windows 100% of the time whi

Re: [PATCH 16/17] pathspec: small readability changes

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > A few small changes to improve readability. This is done by grouping > > related > > assignments, adding blank lines, ensuring lines are <80 characters, etc. > > >

Re: [PATCH 11/17] pathspec: factor global magic into its own function

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > Create helper functions to read the global magic environment variables > > in additon to factoring out the global magic gathering logic into its > > own function. > > > >

Re: [PATCH 09/17] pathspec: always show mnemonic and name in unsupported_magic

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > @@ -426,8 +423,7 @@ void parse_pathspec(struct pathspec *pathspec, > > nr_exclude++; > > if (item[i].magic & magic_mask) > >

Re: [PATCH 09/17] pathspec: always show mnemonic and name in unsupported_magic

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > @@ -413,10 +411,9 @@ void parse_pathspec(struct pathspec *pathspec, > > prefixlen = prefix ? strlen(prefix) : 0; > > > > for (i = 0; i < n; i++) { > >

Re: [PATCH 04/17] ls-tree: convert show_recursive to use the pathspec struct interface

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > Convert 'show_recursive()' to use the pathspec struct interface from > > using the '_raw' entry in the pathspec struct. > > Slightly off-topic (sorry, but you ma

Re: [PATCH 03/17] dir: convert fill_directory to use the pathspec struct interface

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > Convert 'fill_directory()' to use the pathspec struct interface from > > using the '_raw' entry in the pathspec struct. > > > > Signed-off-by: Brandon Williams

Re: [PATCH 16/17] pathspec: small readability changes

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > A few small changes to improve readability. This is done by grouping > > related > > assignments, adding blank lines, ensuring lines are <80 characters, etc. > > >

Re: [PATCH 02/17] dir: convert create_simplify to use the pathspec struct interface

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > Convert 'create_simplify()' to use the pathspec struct interface from > > using the '_raw' entry in the pathspec. > > It would be even better to kill this create_si

Re: [PATCH 01/17] mv: convert to using pathspec struct interface

2016-12-07 Thread Brandon Williams
On 12/07, Duy Nguyen wrote: > On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > > Convert the 'internal_copy_pathspec()' function to use the pathspec > > struct interface from using the deprecated 'get_pathspec()' interface. > > > > In add

Re: [PATCHv5 5/5] submodule: add embed-git-dir function

2016-12-07 Thread Brandon Williams
n these lines, looks like there is an extra space before "submodule--helper" -- Brandon Williams

Re: [PATCHv5 4/5] worktree: get worktrees from submodules

2016-12-07 Thread Brandon Williams
gt; Yours is cleaner; I don't remember what I was thinking. > > Feel free to squash it in; in case a resend is needed I will do that. Just make sure to leave that free in as it refers to another variable (submodule_gitdir). It actually turns out there is a memory leak in the original code because submodule_common_dir is never freed after being detached from the strbuf. -- Brandon Williams

Re: [PATCH] real_path: make real_path thread-safe

2016-12-08 Thread Brandon Williams
On 12/08, Duy Nguyen wrote: > On Tue, Dec 6, 2016 at 3:16 AM, Brandon Williams wrote: > > On 12/05, Stefan Beller wrote: > >> > static const char *real_path_internal(const char *path, int > >> > die_on_error) > >> > { > >> > - sta

Re: [PATCH 01/17] mv: convert to using pathspec struct interface

2016-12-08 Thread Brandon Williams
On 12/08, Duy Nguyen wrote: > On Thu, Dec 8, 2016 at 7:36 AM, Brandon Williams wrote: > >> > @@ -25,25 +26,43 @@ static const char **internal_copy_pathspec(const > >> > char *prefix, > >> > { > >> > int i; > >> >

Re: [PATCH 02/17] dir: convert create_simplify to use the pathspec struct interface

2016-12-08 Thread Brandon Williams
On 12/08, Duy Nguyen wrote: > On Thu, Dec 8, 2016 at 7:03 AM, Brandon Williams wrote: > > On 12/07, Duy Nguyen wrote: > >> On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > >> > Convert 'create_simplify()' to use the pathspec struct interface f

[PATCH v2 01/16] mv: remove use of deprecated 'get_pathspec()'

2016-12-08 Thread Brandon Williams
e freed after getting the result from 'prefix_path()'. Signed-off-by: Brandon Williams --- builtin/mv.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index 2f43877..4e86dc5 100644 --- a/buil

[PATCH v2 00/16] pathspec cleanup

2016-12-08 Thread Brandon Williams
v2 of this series addresses the comments brought up in v1, most of which were small cosmetic changes (since this is mostly a cosmetic series to begin with). Brandon Williams (16): mv: remove use of deprecated 'get_pathspec()' dir: convert create_simplify to use the pathspec struct

[PATCH v2 10/16] pathspec: factor global magic into its own function

2016-12-08 Thread Brandon Williams
Create helper functions to read the global magic environment variables in additon to factoring out the global magic gathering logic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 127 + 1 file changed, 78

[PATCH v2 03/16] dir: convert fill_directory to use the pathspec struct interface

2016-12-08 Thread Brandon Williams
Convert 'fill_directory()' to use the pathspec struct interface from using the '_raw' entry in the pathspec struct. Signed-off-by: Brandon Williams --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 7df292b..a50b6f

[PATCH v2 09/16] pathspec: simpler logic to prefix original pathspec elements

2016-12-08 Thread Brandon Williams
more general situations. Also, slightly change the logic which decides when to prefix the original element in order to prevent a pathspec of "." from getting converted to "" (empty string). Signed-off-by: Brandon Williams --- pathspec.c | 33 +--

[PATCH v2 06/16] pathspec: copy and free owned memory

2016-12-08 Thread Brandon Williams
ct, they need to be freed when clearing the pathspec struct (in 'clear_pathspec()') and duplicated when copying the pathspec struct (in 'copy_pathspec()'). Also change the type of 'match' and 'original' to 'char *' in order to more explicitly show the

[PATCH v2 11/16] pathspec: create parse_short_magic function

2016-12-08 Thread Brandon Williams
Factor out the logic responsible for parsing short magic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/pathspec.c index 523d7bf

[PATCH v2 02/16] dir: convert create_simplify to use the pathspec struct interface

2016-12-08 Thread Brandon Williams
Convert 'create_simplify()' to use the pathspec struct interface from using the '_raw' entry in the pathspec. Signed-off-by: Brandon Williams --- dir.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/dir.c b/dir.c index bfa

[PATCH v2 12/16] pathspec: create parse_long_magic function

2016-12-08 Thread Brandon Williams
Factor out the logic responsible for parsing long magic into its own function. As well as hoist the prefix check logic outside of the inner loop as there isn't anything that needs to be done after matching "prefix:". Signed-off-by: Brandon Williams ---

[PATCH v2 16/16] pathspec: rename prefix_pathspec to init_pathspec_item

2016-12-08 Thread Brandon Williams
Give a more relevant name to the prefix_pathspec function as it does more than just prefix a pathspec element. Signed-off-by: Brandon Williams --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/pathspec.c index 4686298

[PATCH v2 13/16] pathspec: create parse_element_magic helper

2016-12-08 Thread Brandon Williams
Factor out the logic responsible for the magic in a pathspec element into its own function. Also avoid calling into the parsing functions when `PATHSPEC_LITERAL_PATH` is specified since it causes magic to be ignored and all paths to be treated as literals. Signed-off-by: Brandon Williams

[PATCH v2 14/16] pathspec: create strip submodule slash helpers

2016-12-08 Thread Brandon Williams
Factor out the logic responsible for stripping the trailing slash on pathspecs referencing submodules into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 68 ++ 1 file changed, 42 insertions(+), 26 deletions

[PATCH v2 15/16] pathspec: small readability changes

2016-12-08 Thread Brandon Williams
A few small changes to improve readability. This is done by grouping related assignments, adding blank lines, ensuring lines are <80 characters, and adding additional comments. Signed-off-by: Brandon Williams --- pathspec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deleti

[PATCH v2 04/16] ls-tree: convert show_recursive to use the pathspec struct interface

2016-12-08 Thread Brandon Williams
Convert 'show_recursive()' to use the pathspec struct interface from using the '_raw' entry in the pathspec struct. Signed-off-by: Brandon Williams --- builtin/ls-tree.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/ls-tree.c

[PATCH v2 08/16] pathspec: always show mnemonic and name in unsupported_magic

2016-12-08 Thread Brandon Williams
more easily search the man pages for that magic type. This also avoids passing an extra parameter around the pathspec initialization code. Signed-off-by: Brandon Williams --- pathspec.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/pathspec.c b/paths

[PATCH v2 05/16] pathspec: remove the deprecated get_pathspec function

2016-12-08 Thread Brandon Williams
he old functionality of modifying the const char **argv array that was passed into parse_pathspec. Instead the constructed 'match' string (which is a pathspec element with the prefix prepended) is only stored in its corresponding pathspec_item entry. Signed-off-by: Brandon Williams --

Re: [PATCH] real_path: make real_path thread-safe

2016-12-08 Thread Brandon Williams
t using '\' as a directory separator instead of '/'. > > >It seams that we may wnat a function get_start_of_path(uncpath), > >which returns: > > > >get_start_of_path_win("//?/D:/very-long-path") "/very-long-path" > > We have offset_1st_component(). Thanks for letting me know this function exists, that makes my job a bit easier. -- Brandon Williams

[PATCH v2 07/16] pathspec: remove unused variable from unsupported_magic

2016-12-08 Thread Brandon Williams
Removed unused variable 'n' from the 'unsupported_magic()' function. Signed-off-by: Brandon Williams --- pathspec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pathspec.c b/pathspec.c index 8f367f0..ec0d590 100644 --- a/pathspec.c +++ b/pathspe

[PATCH v2 2/4] real_path: convert real_path_internal to strbuf_realpath

2016-12-08 Thread Brandon Williams
Change the name of real_path_internal to strbuf_realpath. In addition push the static strbuf up to its callers and instead take as a parameter a pointer to a strbuf to use for the final result. This change makes strbuf_realpath reentrant. Signed-off-by: Brandon Williams --- abspath.c | 53

[PATCH v2 1/4] real_path: resolve symlinks by hand

2016-12-08 Thread Brandon Williams
aking real_path one step closer to being reentrant. Signed-off-by: Brandon Williams --- abspath.c | 183 +- 1 file changed, 122 insertions(+), 61 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de8..92f2a29 100644 --- a/absp

[PATCH v2 0/4] road to reentrant real_path

2016-12-08 Thread Brandon Williams
callers of real_path_internal * renamed real_path_internal to strbuf_realpath * added real_pathdup * migrated some callers of real_path to real_pathdup and strbuf_realpath Brandon Williams (4): real_path: resolve symlinks by hand real_path: convert real_path_internal to strbuf_realpath real_path

[PATCH v2 3/4] real_path: create real_pathdup

2016-12-08 Thread Brandon Williams
Create real_pathdup which returns a caller owned string of the resolved realpath based on the provide path. Signed-off-by: Brandon Williams --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c index b0d4c1b..df37356 100644

[PATCH v2 4/4] real_path: have callers use real_pathdup and strbuf_realpath

2016-12-08 Thread Brandon Williams
Migrate callers of real_path() who duplicate the retern value to use real_pathdup or strbuf_realpath. Signed-off-by: Brandon Williams --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 15 +-- sha1_file.c | 2 +- submodule.c | 2

Re: [PATCH v2 00/16] pathspec cleanup

2016-12-09 Thread Brandon Williams
On 12/08, Junio C Hamano wrote: > Will queue, but with fixes on issues spotted by my pre-acceptance > mechanical filter squashed in, to fix style issues in the > destination of code movements. Is this pre-acceptance filter you use something that I could run locally? -- Brandon Williams

[PATCH 14/16] pathspec: create strip submodule slash helpers

2016-12-09 Thread Brandon Williams
Factor out the logic responsible for stripping the trailing slash on pathspecs referencing submodules into its own function. Change-Id: Icad62647c04b4195309def0e3db416203d14f9e4 Signed-off-by: Brandon Williams --- pathspec.c | 68 ++ 1

Re: [PATCH 02/17] dir: convert create_simplify to use the pathspec struct interface

2016-12-09 Thread Brandon Williams
On 12/09, Duy Nguyen wrote: > On Fri, Dec 9, 2016 at 1:19 AM, Brandon Williams wrote: > > On 12/08, Duy Nguyen wrote: > >> On Thu, Dec 8, 2016 at 7:03 AM, Brandon Williams wrote: > >> > On 12/07, Duy Nguyen wrote: > >> >> On Wed, Dec 7, 2016

Re: [PATCH v2 0/4] road to reentrant real_path

2016-12-09 Thread Brandon Williams
On 12/09, Duy Nguyen wrote: > On Fri, Dec 9, 2016 at 6:58 AM, Brandon Williams wrote: > > diff --git a/setup.c b/setup.c > > index fe572b8..0d9fdd0 100644 > > --- a/setup.c > > +++ b/setup.c > > @@ -254,10 +254,12 @@ int get_common_dir_noenv(struct st

Re: [PATCH v2 1/4] real_path: resolve symlinks by hand

2016-12-09 Thread Brandon Williams
On 12/09, Johannes Sixt wrote: > Am 09.12.2016 um 00:58 schrieb Brandon Williams: > >The current implementation of real_path uses chdir() in order to resolve > >symlinks. Unfortunately this isn't thread-safe as chdir() affects a > >process as a whole and not just an i

Re: [PATCH 14/16] pathspec: create strip submodule slash helpers

2016-12-09 Thread Brandon Williams
On 12/09, Stefan Beller wrote: > On Fri, Dec 9, 2016 at 11:18 AM, Brandon Williams wrote: > > Factor out the logic responsible for stripping the trailing slash on > > pathspecs referencing submodules into its own function. > > > > Change-Id: Icad62647c04b4195309def0e3d

Re: [PATCHv6 4/7] worktree: get worktrees from submodules

2016-12-09 Thread Brandon Williams
ore.repositoryformatversion, or find any unrecognized > > extensions. But the problem is not specific to this code. And fixing > > it is no small task. But perhaps we could call a dummy > > validate_submodule_gitdir() here? Then when we implement that function > > for real, we don't have to search the entire code base to see where to > > put it. > > > > Kinda off-topic though. Feel free to ignore the above comment. > > ok I'll add a TODO/emptyfunction for that. So is using resolve_gitdir not ok when trying to see if a submodule has a gitdir at a particular path? -- Brandon Williams

Re: [PATCH v2 12/16] pathspec: create parse_long_magic function

2016-12-09 Thread Brandon Williams
On 12/09, Stefan Beller wrote: > On Fri, Dec 9, 2016 at 3:44 PM, Junio C Hamano wrote: > > Brandon Williams writes: > > > >> Factor out the logic responsible for parsing long magic into its own > >> function. As well as hoist the prefix check logic outside of t

[PATCH v3 0/4] road to reentrant real_path

2016-12-12 Thread Brandon Williams
Changes in v3: * Rewrite of `strip_last_component()` as the v2 verison didn't properly handle inputs like '/foo'. Thanks to Johannes for pointing this out and suggesting a solution. * Small style changes * Revert the call in `get_common_dir_noenv()` to maintain proper function

[PATCH v3 3/4] real_path: create real_pathdup

2016-12-12 Thread Brandon Williams
Create real_pathdup which returns a caller owned string of the resolved realpath based on the provide path. Signed-off-by: Brandon Williams --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c index 8c6c76b..79ee310 100644

[PATCH v3 1/4] real_path: resolve symlinks by hand

2016-12-12 Thread Brandon Williams
aking real_path one step closer to being reentrant. Signed-off-by: Brandon Williams --- abspath.c | 190 ++ 1 file changed, 129 insertions(+), 61 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de8..cafcae0 100644 --- a/absp

[PATCH v3 4/4] real_path: have callers use real_pathdup and strbuf_realpath

2016-12-12 Thread Brandon Williams
Migrate callers of real_path() who duplicate the retern value to use real_pathdup or strbuf_realpath. Signed-off-by: Brandon Williams --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 13 - sha1_file.c | 2 +- submodule.c | 2

[PATCH v3 2/4] real_path: convert real_path_internal to strbuf_realpath

2016-12-12 Thread Brandon Williams
Change the name of real_path_internal to strbuf_realpath. In addition push the static strbuf up to its callers and instead take as a parameter a pointer to a strbuf to use for the final result. This change makes strbuf_realpath reentrant. Signed-off-by: Brandon Williams --- abspath.c | 53

Re: [PATCHv7 0/6] submodule absorbgitdirs

2016-12-12 Thread Brandon Williams
ded one test title slightly. > * interdiff to v7 (that is queued as origin/sb/submodule-embed-gitdir) below. > not important but your cover letter's subject is v7 instead of v8 :) -- Brandon Williams

Re: [PATCH v3 1/4] real_path: resolve symlinks by hand

2016-12-12 Thread Brandon Williams
On 12/12, Junio C Hamano wrote: > Brandon Williams writes: > > > +/* removes the last path component from 'path' except if 'path' is root */ > > +static void strip_last_component(struct strbuf *path) > > +{ > > + size_t offset = offset_1st_co

Re: [PATCH v3 4/4] real_path: have callers use real_pathdup and strbuf_realpath

2016-12-12 Thread Brandon Williams
On 12/12, Stefan Beller wrote: > On Mon, Dec 12, 2016 at 3:47 PM, Junio C Hamano wrote: > > Junio C Hamano writes: > > > >> Brandon Williams writes: > >> > >>> Migrate callers of real_path() who duplicate the retern value to use > >>&

Re: What's cooking in git.git (Dec 2016, #02; Mon, 12)

2016-12-13 Thread Brandon Williams
a ":" which isn't supported on windows. I have that change made in my local grep branch but I haven't sent out a reroll of the series yet due to the underlying race-condition that existed (due to the way realpath was being calculated). I'll send out a reroll of the series once the discussion on bw/realpath-wo-chdir has concluded (as the grep series is now dependent on it). -- Brandon Williams

Re: [PATCH 02/17] dir: convert create_simplify to use the pathspec struct interface

2016-12-13 Thread Brandon Williams
On 12/09, Brandon Williams wrote: > On 12/09, Duy Nguyen wrote: > > On Fri, Dec 9, 2016 at 1:19 AM, Brandon Williams wrote: > > > On 12/08, Duy Nguyen wrote: > > >> On Thu, Dec 8, 2016 at 7:03 AM, Brandon Williams > > >> wrote: > > >> >

[PATCH v3 02/16] dir: remove struct path_simplify

2016-12-13 Thread Brandon Williams
Teach simplify_away() and exclude_matches_pathspec() to handle struct pathspec directly, eliminating the need for the struct path_simplify. Also renamed the len parameter to pathlen in exclude_matches_pathspec() to match the parameter names used in simplify_away(). Signed-off-by: Brandon

[PATCH v3 00/16] pathspec cleanup

2016-12-13 Thread Brandon Williams
) and exclude_matches_pathspec(). [02/16] * small style issues corrected from v2. [15/16] Brandon Williams (16): mv: remove use of deprecated 'get_pathspec()' dir: remove struct path_simplify dir: convert fill_directory to use the pathspec struct interface ls-tree: convert show_recur

[PATCH v3 03/16] dir: convert fill_directory to use the pathspec struct interface

2016-12-13 Thread Brandon Williams
Convert 'fill_directory()' to use the pathspec struct interface from using the '_raw' entry in the pathspec struct. Signed-off-by: Brandon Williams --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index aadf073..15f7c9

[PATCH v3 04/16] ls-tree: convert show_recursive to use the pathspec struct interface

2016-12-13 Thread Brandon Williams
Convert 'show_recursive()' to use the pathspec struct interface from using the '_raw' entry in the pathspec struct. Signed-off-by: Brandon Williams --- builtin/ls-tree.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/ls-tree.c

[PATCH v3 08/16] pathspec: always show mnemonic and name in unsupported_magic

2016-12-13 Thread Brandon Williams
more easily search the man pages for that magic type. This also avoids passing an extra parameter around the pathspec initialization code. Signed-off-by: Brandon Williams --- pathspec.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/pathspec.c b/paths

[PATCH v3 09/16] pathspec: simpler logic to prefix original pathspec elements

2016-12-13 Thread Brandon Williams
more general situations. Also, slightly change the logic which decides when to prefix the original element in order to prevent a pathspec of "." from getting converted to "" (empty string). Signed-off-by: Brandon Williams --- pathspec.c | 33 +--

[PATCH v3 01/16] mv: remove use of deprecated 'get_pathspec()'

2016-12-13 Thread Brandon Williams
e freed after getting the result from 'prefix_path()'. Signed-off-by: Brandon Williams --- builtin/mv.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index 2f43877..4e86dc5 100644 --- a/buil

[PATCH v3 06/16] pathspec: copy and free owned memory

2016-12-13 Thread Brandon Williams
ct, they need to be freed when clearing the pathspec struct (in 'clear_pathspec()') and duplicated when copying the pathspec struct (in 'copy_pathspec()'). Also change the type of 'match' and 'original' to 'char *' in order to more explicitly show the

[PATCH v3 07/16] pathspec: remove unused variable from unsupported_magic

2016-12-13 Thread Brandon Williams
Removed unused variable 'n' from the 'unsupported_magic()' function. Signed-off-by: Brandon Williams --- pathspec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pathspec.c b/pathspec.c index 8f367f0..ec0d590 100644 --- a/pathspec.c +++ b/pathspe

[PATCH v3 05/16] pathspec: remove the deprecated get_pathspec function

2016-12-13 Thread Brandon Williams
he old functionality of modifying the const char **argv array that was passed into parse_pathspec. Instead the constructed 'match' string (which is a pathspec element with the prefix prepended) is only stored in its corresponding pathspec_item entry. Signed-off-by: Brandon Williams --

[PATCH v3 15/16] pathspec: small readability changes

2016-12-13 Thread Brandon Williams
A few small changes to improve readability. This is done by grouping related assignments, adding blank lines, ensuring lines are <80 characters, and adding additional comments. Signed-off-by: Brandon Williams --- pathspec.c | 25 +++-- 1 file changed, 15 insertions(+),

[PATCH v3 13/16] pathspec: create parse_element_magic helper

2016-12-13 Thread Brandon Williams
Factor out the logic responsible for the magic in a pathspec element into its own function. Also avoid calling into the parsing functions when `PATHSPEC_LITERAL_PATH` is specified since it causes magic to be ignored and all paths to be treated as literals. Signed-off-by: Brandon Williams

[PATCH v3 14/16] pathspec: create strip submodule slash helpers

2016-12-13 Thread Brandon Williams
Factor out the logic responsible for stripping the trailing slash on pathspecs referencing submodules into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 68 ++ 1 file changed, 42 insertions(+), 26 deletions

[PATCH v3 12/16] pathspec: create parse_long_magic function

2016-12-13 Thread Brandon Williams
Factor out the logic responsible for parsing long magic into its own function. As well as hoist the prefix check logic outside of the inner loop as there isn't anything that needs to be done after matching "prefix:". Signed-off-by: Brandon Williams ---

[PATCH v3 16/16] pathspec: rename prefix_pathspec to init_pathspec_item

2016-12-13 Thread Brandon Williams
Give a more relevant name to the prefix_pathspec function as it does more than just prefix a pathspec element. Signed-off-by: Brandon Williams --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/pathspec.c index 4ce2016

[PATCH v3 11/16] pathspec: create parse_short_magic function

2016-12-13 Thread Brandon Williams
Factor out the logic responsible for parsing short magic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/pathspec.c index 10ce9c1

[PATCH v3 10/16] pathspec: factor global magic into its own function

2016-12-13 Thread Brandon Williams
Create helper functions to read the global magic environment variables in additon to factoring out the global magic gathering logic into its own function. Signed-off-by: Brandon Williams --- pathspec.c | 127 + 1 file changed, 78

Re: What's cooking in git.git (Dec 2016, #03; Tue, 13)

2016-12-13 Thread Brandon Williams
tch/push have been enabled via a new configuration > mechanism. > > What's the doneness of this topic? Did we agree that it should be > rebased on top of Peff's http-walker-limit-redirect series? Yes I believe we agreed it should be rebased on Peff's series. I can do that and send out another version. -- Brandon Williams

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

2016-12-13 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 v9 0/5] transport protocol policy configuration

2016-12-13 Thread Brandon Williams
Only difference between v8 and v9 is that v9 has been rebased ontop of Jeff's http-walker-limit-redirect series 'jk/http-walker-limit-redirect'. Brandon Williams (5): lib-proto-disable: variable name fix transport: add protocol policy config option http: always warn if lib

[PATCH v9 1/5] lib-proto-disable: variable name fix

2016-12-13 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

[PATCH v9 3/5] http: always warn if libcurl version is too old

2016-12-13 Thread Brandon Williams
Now that there are default "known-good" and "known-bad" protocols which are allowed/disallowed by 'is_transport_allowed' we should always warn the user that older versions of libcurl can't respect the allowed protocols for redirects. Signed-off-by: Bra

[PATCH v9 4/5] http: create function to get curl allowed protocols

2016-12-13 Thread Brandon Williams
Move the creation of an allowed protocols whitelist to a helper function. Signed-off-by: Brandon Williams --- http.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/http.c b/http.c index 034426e..f7c488a 100644 --- a/http.c +++ b/http.c

[PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-13 Thread Brandon Williams
e provided which falls back to reading `GIT_PROTOCOL_FROM_USER` to determine if the protocol came from the user. Signed-off-by: Brandon Williams --- http.c | 14 +++--- transport.c | 8 +--- transport.h | 13 ++--- 3 files changed, 22 insertions(+), 13 deletions(-) di

Re: [PATCH v9 3/5] http: always warn if libcurl version is too old

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Tue, Dec 13, 2016 at 05:40:35PM -0800, Brandon Williams wrote: > > > diff --git a/transport.c b/transport.c > > index e1ba78b..fbd799d 100644 > > --- a/transport.c > > +++ b/transport.c > > @@ -700,11 +700,6 @@ void tran

Re: [PATCH v9 4/5] http: create function to get curl allowed protocols

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Tue, Dec 13, 2016 at 05:40:36PM -0800, Brandon Williams wrote: > > > Move the creation of an allowed protocols whitelist to a helper > > function. > > This is "what" but not "why". You can figure it out if you see the

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Tue, Dec 13, 2016 at 05:40:37PM -0800, Brandon Williams wrote: > > > Add the from_user parameter to the 'is_transport_allowed' function. > > This allows callers to query if a transport protocol is allowed, given > > that the caller

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Brandon Williams wrote: > On 12/14, Jeff King wrote: > > On Tue, Dec 13, 2016 at 05:40:37PM -0800, Brandon Williams wrote: > > > > > Add the from_user parameter to the 'is_transport_allowed' function. > > > This allows callers to quer

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
On 12/14, Jeff King wrote: > On Wed, Dec 14, 2016 at 12:37:52PM -0800, Brandon Williams wrote: > > > Naively looking at the code (and your longer suggestion), is there a > > reason why we couldn't simply have http-walker set CURLOPT_PROTOCOLS > > with get_cur

Re: [PATCH v9 5/5] transport: add from_user parameter to is_transport_allowed

2016-12-14 Thread Brandon Williams
n top of your series, plus the other minor fixes > we've discussed, the topic should be ready for 'next'. Sounds good, I'll make those few changes, place this patch ontop of the series and send out v10 of the series in just a bit. -- Brandon Williams

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