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

2017-01-03 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 <bmw...@google.com> --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 1df

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

2017-01-03 Thread Brandon Williams
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 ownership of the memory. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v4 3/5] real_path: create real_pathdup

2017-01-03 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 <bmw...@google.com> --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c

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

2017-01-03 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 <bmw...@google.com> --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 13 - sha1_file.c | 2 +- submo

[PATCH v4 2/5] real_path: convert real_path_internal to strbuf_realpath

2017-01-03 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 <bmw...@google.

[PATCH v4 5/5] real_path: canonicalize directory separators in root parts

2017-01-03 Thread Brandon Williams
From: Johannes Sixt When an absolute path is resolved, resolution begins at the first path component after the root part. The root part is just copied verbatim, because it must not be inspected for symbolic links. For POSIX paths, this is just the initial slash, but on Windows,

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

2017-01-03 Thread Brandon Williams
Removed unused variable 'n' from the 'unsupported_magic()' function. Signed-off-by: Brandon Williams <bmw...@google.com> --- pathspec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pathspec.c b/pathspec.c index b8faa8f46..b9a3819d6 100644 --- a/pathspec.c

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

2017-01-03 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 <bmw...@google.com> --- pathspec.c | 68 ++ 1 file changed, 42 inse

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

2017-01-03 Thread Brandon Williams
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 <bmw...@google.com> --- pathspec.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff

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

2017-01-03 Thread Brandon Williams
, 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 <bmw...@google.com> --- pathspec.c | 33 + 1 f

[PATCH v4 00/16] pathspec cleanup

2017-01-03 Thread Brandon Williams
v4 addresses a few comments from Duy. * [2/16] push the guard pathspec macro into simplify_away() and exclude_matches_pathsepc(). * [6/16] when freeing a pathspec struct, set pathsepc->nr = 0. * [8/16] tweak the die message when using unsupported magic to be more human readable. Bran

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

2017-01-03 Thread Brandon Williams
ive.travis-ci.org/jobs/187092215/log.txt > > - Lars > Simple fix would be to just revert MAXSYMLINKS to be MAXDEPTH (which is what the #define was before this series). I'll resend the series with that fix. -- Brandon Williams

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

2017-01-03 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 <bmw...@google.com> --- pathspec.c | 25 +++-- 1 file ch

[PATCH v4 1/5] real_path: resolve symlinks by hand

2017-01-03 Thread Brandon Williams
real_path one step closer to being reentrant. Signed-off-by: Brandon Williams <bmw...@google.com> --- abspath.c | 188 ++ 1 file changed, 128 insertions(+), 60 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de859..0f3

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

2017-01-03 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 v4 0/5] road to reentrant real_path

2017-01-03 Thread Brandon Williams
Only change with v4 is in [1/5] renaming the #define MAXSYMLINKS back to MAXDEPTH due to a naming conflict brought up by Lars Schneider. Brandon Williams (4): real_path: resolve symlinks by hand real_path: convert real_path_internal to strbuf_realpath real_path: create real_pathdup

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

2017-01-03 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 <bmw...@google.com> ---

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

2017-01-03 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 <bmw...@google.com> --- builtin/ls-tree.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/ls-tr

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

2017-01-03 Thread Brandon Williams
()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/mv.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index 2f43877bc..4e86dc523 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @

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

2017-01-03 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 v4 11/16] pathspec: create parse_short_magic function

2017-01-03 Thread Brandon Williams
Factor out the logic responsible for parsing short magic into its own function. Signed-off-by: Brandon Williams <bmw...@google.com> --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/path

Re: [PATCHv5] pathspec: give better message for submodule related pathspec error

2017-01-04 Thread Brandon Williams
' is in submodule 'sub' > +EOF > + > +test_expect_success 'error message for path inside submodule' ' > + echo a >sub/a && > + test_must_fail git add sub/a 2>actual && > + test_cmp expect actual > +' > + > +cat <expect > +fatal: Pathspec '.' is in submodule 'sub' > +EOF > + > +test_expect_success 'error message for path inside submodule from within > submodule' ' > + test_must_fail git -C sub add . 2>actual && > + test_cmp expect actual > +' > + > +test_done I haven't taken a through look at this patch but I think you may want to base it off of 'origin/bw/pathspec-cleanup' series as the changes made in this patch now conflict with that series. Also I still don't really think this solves the problem of telling the user what is wrong, which is that the submodule's gitdir is gone. -- Brandon Williams

Re: [PATCH v5 00/16] pathspec cleanup

2017-01-09 Thread Brandon Williams
On 01/07, Duy Nguyen wrote: > On Thu, Jan 5, 2017 at 1:03 AM, Brandon Williams <bmw...@google.com> wrote: > > Changes in v5: > > * Move GUARD_PATHSPEC to prevent checking if pathspec is null twice. > > * Mark a string containing 'mnemonic' for translation. > &

Re: [PATCH v5 0/5] road to reentrant real_path

2017-01-09 Thread Brandon Williams
On 01/07, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > changes in v5: > > * set errno to ELOOP when MAXSYMLINKS is exceded. > > * revert to use MAXSYMLINKS instead of MAXDEPTH. > > * If the OS hasn't defined MAXSYMLINKS, use a f

Re: [PATCH v5 0/5] road to reentrant real_path

2017-01-09 Thread Brandon Williams
On 01/09, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > >> How does this relate to the 5-patch real_path: series that has been > >> on 'next' since last year? > > > > The only difference should be in the first patch of the

[PATCH 1/2] real_path: prevent redefinition of MAXSYMLINKS

2017-01-09 Thread Brandon Williams
The macro 'MAXSYMLINKS' is already defined on macOS and Linux in . If 'MAXSYMLINKS' has already been defined, use the value defined by the OS otherwise default to a value of 32 which is more inline with what is allowed by many systems. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH 2/2] real_path: set errno when max number of symlinks is exceeded

2017-01-09 Thread Brandon Williams
Set errno to ELOOP when the maximum number of symlinks is exceeded, as would be done by other symlink-resolving functions. Signed-off-by: Brandon Williams <bmw...@google.com> --- abspath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/abspath.c b/abspath.c index 0393213e5..fce

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

2017-01-04 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 <bmw...@google.com> --- builtin/ls-tree.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/ls-tr

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

2017-01-04 Thread Brandon Williams
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 <bmw...@google.

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

2017-01-04 Thread Brandon Williams
()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/mv.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index 2f43877bc..4e86dc523 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @

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

2017-01-04 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 v5 00/16] pathspec cleanup

2017-01-04 Thread Brandon Williams
Changes in v5: * Move GUARD_PATHSPEC to prevent checking if pathspec is null twice. * Mark a string containing 'mnemonic' for translation. Brandon Williams (16): mv: remove use of deprecated 'get_pathspec()' dir: remove struct path_simplify dir: convert fill_directory to use the pathspec

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

2017-01-04 Thread Brandon Williams
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 ownership of the memory. Signed-off-by: Brandon Williams <bmw...@google.

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

2017-01-04 Thread Brandon Williams
Removed unused variable 'n' from the 'unsupported_magic()' function. Signed-off-by: Brandon Williams <bmw...@google.com> --- pathspec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pathspec.c b/pathspec.c index b8faa8f46..b9a3819d6 100644 --- a/pathspec.c

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

2017-01-04 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 <bmw...@google.com> --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 9ae

Re: [PATCH v4 0/5] road to reentrant real_path

2017-01-04 Thread Brandon Williams
On 01/04, Jeff King wrote: > On Wed, Jan 04, 2017 at 07:56:02AM +0100, Torsten Bögershausen wrote: > > > On 04.01.17 01:48, Jeff King wrote: > > > On Tue, Jan 03, 2017 at 11:09:18AM -0800, Brandon Williams wrote: > > > > > >> Only change with v4 is in [

Re: [PATCH v4 00/16] pathspec cleanup

2017-01-04 Thread Brandon Williams
On 01/04, Duy Nguyen wrote: > On Wed, Jan 4, 2017 at 1:42 AM, Brandon Williams <bmw...@google.com> wrote: > > diff --git a/dir.c b/dir.c > > index 15f7c9993..e8ddd7f8a 100644 > > --- a/dir.c > > +++ b/dir.c > > @@ -1353,6 +1353,15 @@ static int simplify_

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

2017-01-04 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 <bmw...@google.com> --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/path

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

2017-01-04 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 <bmw...@google.com> ---

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

2017-01-04 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 <bmw...@google.com> --- pathspec.c | 68 ++ 1 file changed, 42 inse

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

2017-01-04 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 <bmw...@google.com> --- pathspec.c | 127 +-

Re: [PATCH v4 00/16] pathspec cleanup

2017-01-04 Thread Brandon Williams
On 01/04, Brandon Williams wrote: > On 01/04, Duy Nguyen wrote: > > On Wed, Jan 4, 2017 at 1:42 AM, Brandon Williams <bmw...@google.com> wrote: > > > diff --git a/dir.c b/dir.c > > > index 15f7c9993..e8ddd7f8a 100644 > > > --- a/dir.c > > >

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

2017-01-04 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 <bmw...@google.com> --- pathspec.c | 25 +++-- 1 file ch

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

2017-01-04 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 v5 08/16] pathspec: always show mnemonic and name in unsupported_magic

2017-01-04 Thread Brandon Williams
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 <bmw...@google.com> --- pathspec.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff

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

2017-01-04 Thread Brandon Williams
Factor out the logic responsible for parsing short magic into its own function. Signed-off-by: Brandon Williams <bmw...@google.com> --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/path

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

2017-01-04 Thread Brandon Williams
, 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 <bmw...@google.com> --- pathspec.c | 33 + 1 f

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

2017-01-04 Thread Brandon Williams
On 01/03, Jacob Keller wrote: > On Tue, Jan 3, 2017 at 11:09 AM, Brandon Williams <bmw...@google.com> wrote: > > Migrate callers of real_path() who duplicate the retern value to use > > real_pathdup or strbuf_realpath. > > Nit: s/retern/return Thanks for catching that

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

2017-01-03 Thread Brandon Williams
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 <bmw...@google.

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

2017-01-03 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 <bmw...@google.com> --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/path

Re: [PATCH 2/2] pathspec: give better message for submodule related pathspec error

2017-01-04 Thread Brandon Williams
f the submodule's gitdir has been destroyed and instead it has fallen back to its parent's gitdir. A check for something like this should happen much sooner. There are cases where it is advantages to be able to supply a pathspec into a submodule without it erroring out (git grep --recurse-submodules is one example). So right now the current method for not allowing a pathspec into a submodule is to pass the STRIP_SUBMODULE_SLASH_EXPENSIVE flag when creating the pathspec object. -- Brandon Williams

[PATCH v5 1/5] real_path: resolve symlinks by hand

2017-01-04 Thread Brandon Williams
real_path one step closer to being reentrant. Signed-off-by: Brandon Williams <bmw...@google.com> --- abspath.c | 194 ++ 1 file changed, 133 insertions(+), 61 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de859..629

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

2017-01-04 Thread Brandon Williams
Migrate callers of real_path() who duplicate the return value to use real_pathdup or strbuf_realpath. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 13 - sha1_file.c | 2 +- submo

[PATCH v5 3/5] real_path: create real_pathdup

2017-01-04 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 <bmw...@google.com> --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c

[PATCH v5 0/5] road to reentrant real_path

2017-01-04 Thread Brandon Williams
changes in v5: * set errno to ELOOP when MAXSYMLINKS is exceded. * revert to use MAXSYMLINKS instead of MAXDEPTH. * If the OS hasn't defined MAXSYMLINKS, use a fallback value of 32. Brandon Williams (4): real_path: resolve symlinks by hand real_path: convert real_path_internal

Re: [PATCH v4 0/5] road to reentrant real_path

2017-01-04 Thread Brandon Williams
On 01/04, Jacob Keller wrote: > On Wed, Jan 4, 2017 at 10:22 AM, Stefan Beller <sbel...@google.com> wrote: > > On Wed, Jan 4, 2017 at 10:13 AM, Brandon Williams <bmw...@google.com> wrote: > >> On 01/04, Jeff King wrote: > >>> On Wed, Jan 04, 2017 at 07

[PATCH v5 5/5] real_path: canonicalize directory separators in root parts

2017-01-04 Thread Brandon Williams
From: Johannes Sixt When an absolute path is resolved, resolution begins at the first path component after the root part. The root part is just copied verbatim, because it must not be inspected for symbolic links. For POSIX paths, this is just the initial slash, but on Windows,

[PATCH v5 2/5] real_path: convert real_path_internal to strbuf_realpath

2017-01-04 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 <bmw...@google.

[PATCH 3/3] push: add option to push only submodules

2016-12-19 Thread Brandon Williams
the superproject to the most recent SHA1 of each submodule. This would eliminate the merge conflicts in the superproject that could occur if multiple people are contributing to the same submodule. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/push.c | 2

[PATCH 2/3] submodules: add RECURSE_SUBMODULES_ONLY value

2016-12-19 Thread Brandon Williams
Add the `RECURSE_SUBMODULES_ONLY` enum value to submodule.h. This enum value will be used in a later patch to push to indicate that only submodules should be pushed, while the superproject should remain unpushed. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule-config

Re: [PATCH bw/realpath-wo-chdir] real_path: canonicalize directory separators in root parts

2016-12-21 Thread Brandon Williams
t;buf); > + > + strbuf_reset(resolved); > + strbuf_add(resolved, remaining->buf, offset); > +#ifdef GIT_WINDOWS_NATIVE > + convert_slashes(resolved->buf); > +#endif So then the only extra cononicalization that is happening here is converting '\\server\share' to '//server/share'? (or 'c:\' to 'c:/') -- Brandon Williams

Re: [PATCH] pathspec: give better message for submodule related pathspec error

2016-12-28 Thread Brandon Williams
t;nowildcard_len <= item->len && > + item->prefix <= item->len) > + die (_("Path leads inside submodule '%s', but the submodule " > +"was not recognized, i.e. not initialized or deleted"), > + ce

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

2016-12-28 Thread Brandon Williams
spec struct interface > - dir: remove struct path_simplify > - mv: remove use of deprecated 'get_pathspec()' > > Code clean-up in the pathspec API. > > Waiting for the (hopefully) final round of review before 'next'. What more needs to be reviewed for this series? -- Brandon Williams

Re: [PATCHv2] pathspec: give better message for submodule related pathspec error

2016-12-28 Thread Brandon Williams
ot initialized or deleted"), > +item->original); > return magic; > } Turns out I should comment on the most recent version of the patch :P This looks better to me. (It resolves the issue with using a variable not in scope). -- Brandon Williams

Re: [PATCH bw/realpath-wo-chdir] real_path: canonicalize directory separators in root parts

2016-12-22 Thread Brandon Williams
On 12/22, Johannes Sixt wrote: > Am 21.12.2016 um 23:33 schrieb Brandon Williams: > >On 12/21, Johannes Sixt wrote: > >>+/* copies root part from remaining to resolved, canonicalizing it on the > >>way */ > >>+static void get_root_part(struct strbuf *res

[PATCH 0/3] push only submodules

2016-12-19 Thread Brandon Williams
of each submodule. This would eliminate the merge conflicts in the superproject that could occur if multiple people are contributing to the same submodule. Brandon Williams (3): transport: refactor flag #defines to be more readable submodules: add RECURSE_SUBMODULES_ONLY value push: add option

[PATCH 1/3] transport: refactor flag #defines to be more readable

2016-12-19 Thread Brandon Williams
and makes the defines easier to read. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport.h | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/transport.h b/transport.h index b8e4ee8..1b65458 100644 --- a/transport.h +++ b/trans

Re: [PATCH 2/2] dir.c: add retry logic to relocate_gitdir

2016-12-19 Thread Brandon Williams
*path, > - const char *old_git_dir, > - const char *new_git_dir); > +extern int relocate_gitdir(const char *path, > +const char *old_git_dir, > +const char *new_git_dir); > #endif > diff --git a/submodule.c b/submodule.c > index 45ccfb7ab4..fa1f44bb5a 100644 > --- a/submodule.c > +++ b/submodule.c > @@ -1277,7 +1277,8 @@ static void > relocate_single_git_dir_into_superproject(const char *prefix, > prefix ? prefix : "", path, > real_old_git_dir, real_new_git_dir); > > - relocate_gitdir(path, real_old_git_dir, real_new_git_dir); > + if (relocate_gitdir(path, real_old_git_dir, real_new_git_dir)) > + die(_("could not relocate git directory of '%s'"), path); > > free(old_git_dir); > free(real_old_git_dir); > -- > 2.11.0.rc2.53.gb7b3fba.dirty > -- Brandon Williams

Re: [PATCHv4 3/5] run-command: add {run,start,finish}_command_or_die

2016-12-19 Thread Brandon Williams
,6 +56,10 @@ int finish_command(struct child_process *); > int finish_command_in_signal(struct child_process *); > int run_command(struct child_process *); > > +void start_command_or_die(struct child_process *); > +void finish_command_or_die(struct child_process *); > +void run_command_or_die(struct child_process *); > + > /* > * Returns the path to the hook file, or NULL if the hook is missing > * or disabled. Note that this points to static storage that will be > -- > 2.11.0.rc2.53.gb7b3fba.dirty > -- Brandon Williams

[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 <bmw...@google.com> ---

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

2016-12-06 Thread Brandon Williams
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 <bmw...@google.

[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 <bmw...@google.com> --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/path

[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 <bmw...@google.com> --- pathspec.c | 120 +-

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

2016-12-06 Thread Brandon Williams
, 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 <bmw...@google.com> --- pathspec.c | 33 + 1 f

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

2016-12-06 Thread Brandon Williams
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 <bmw...@google.com> --- pathspec.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/path

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

2016-12-06 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 <bmw...@google.com> --- builtin/ls-tree.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/builtin/ls-tr

[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 Williams <bmw...@google.

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

2016-12-06 Thread Brandon Williams
as an intermediate step (with modificationed based on the passed in flags). This way the intermediate strings can then be freed prior to duplicating the result of parse_pathspec (which contains each of the elements with the prefix prepended). Signed-off-by: Brandon Williams <bmw...@google.

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

2016-12-06 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 <bmw...@google.com> --- dir.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/dir.c b/dir.c index b

[PATCH 00/17] pathspec cleanup

2016-12-06 Thread Brandon Williams
functions. The overall result is a much more readable function. Brandon Williams (17): mv: convert to using pathspec struct interface dir: convert create_simplify to use the pathspec struct interface dir: convert fill_directory to use the pathspec struct interface ls-tree: convert show_recursive

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

2016-12-06 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 <bmw...@google.com> --- dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dir.c b/dir.c index 7df292b..8730a4f

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

2016-12-06 Thread Brandon Williams
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 ownership of the memory. Signed-off-by: Brandon Williams <bmw...@google.

[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 <bmw...@google.com> --- pathspec.c | 68 ++ 1 file changed, 42 inse

[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 <bmw...@google.com> --- 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/path

[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 <bmw...@google.com> --- pathspec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions

[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 <bmw...@google.com> --- pathspec.c | 9 - 1 file changed, 9 deletions(-) diff --git a/pathspec.c b/pathspec.c index 8a07b02..66db257 100644 --- a/pathspec.c

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

2016-12-07 Thread Brandon Williams
nes, 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
ere 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] sequencer: fix missing newline

2017-03-23 Thread Brandon Williams
On 03/23, Jeff King wrote: > On Thu, Mar 23, 2017 at 10:47:16AM -0700, Brandon Williams wrote: > > > On 03/23, Johannes Schindelin wrote: > > > Hi Brandon, > > > > > > On Thu, 23 Mar 2017, Brandon Williams wrote: > > > > > > > When

Re: [PATCH] sequencer: fix missing newline

2017-03-23 Thread Brandon Williams
On 03/23, Johannes Schindelin wrote: > Hi Brandon, > > On Thu, 23 Mar 2017, Brandon Williams wrote: > > > When using rebase --interactive where one of the lines is marked as > > 'edit' this is the resulting output: > > > > Stopped at ec3b9c4..

Re: What's cooking in git.git (Mar 2017, #10; Fri, 24)

2017-03-24 Thread Brandon Williams
at Dscho's config series hit master so I could rebase against that (as there is a small conflict). Aside from that it didn't seem like there were many complaints with the proposed fix. -- Brandon Williams

[PATCH] sequencer: fix missing newline

2017-03-23 Thread Brandon Williams
character is missing at the end of the "Stopped at ..." line and before the "You can amend ..." line. This patch fixes the malformed output by adding the missing newline character to the end of the "Stopped at ..." line. Signed-off-by: Brandon Williams <bmw...@google.com

[PATCH 1/2] send-pack: send push options correctly in stateless-rpc case

2017-03-22 Thread Brandon Williams
nathan Nieder <jrnie...@gmail.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- send-pack.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/send-pack.c b/send-pack.c index d2d2a49a0..66e652f7e 100644 --- a/send-pack.c +++ b/send

[PATCH 2/2] remote-curl: allow push options

2017-03-22 Thread Brandon Williams
Teach remote-curl to understand push options and to be able to convey them across HTTP. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/send-pack.c | 5 + remote-curl.c | 8 t/t5545-push-options.sh | 30 +- 3 files c

[PATCH 0/2] push options across http

2017-03-22 Thread Brandon Williams
This series enables push options to be sent across http using remote-curl Thanks to Jonathan Nieder for helping troubleshoot. Brandon Williams (2): send-pack: send push options correctly in stateless-rpc case remote-curl: allow push options builtin/send-pack.c | 5 + remote-curl.c

Re: [PATCH v3 3/5] grep: fix bug when recursing with relative pathspec

2017-03-22 Thread Brandon Williams
On 03/21, Duy Nguyen wrote: > On Sat, Mar 18, 2017 at 12:22 AM, Brandon Williams <bmw...@google.com> wrote: > > With these two pieces of information a child process can correctly > > interpret the pathspecs provided by the user as well as being able to > > properly

Re: [PATCH 1/2] send-pack: send push options correctly in stateless-rpc case

2017-03-22 Thread Brandon Williams
On 03/22, Jonathan Nieder wrote: > Brandon Williams wrote: > > > "git send-pack --stateless-rpc" puts each request in a sequence of pkt-lines > > followed by a flush-pkt. The push option code forgot about this and sends > > push > > options and their ter

[PATCH v2 2/2] remote-curl: allow push options

2017-03-22 Thread Brandon Williams
Teach remote-curl to understand push options and to be able to convey them across HTTP. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-send-pack.txt | 6 ++ builtin/send-pack.c | 5 + remote-curl.c | 8 t/t554

[PATCH v2 0/2] push options across http

2017-03-22 Thread Brandon Williams
v2 addresses Jonathan's comments from v1. * Fix a test * Add some documentation * remove short option from --push-option in git send-pack Brandon Williams (2): send-pack: send push options correctly in stateless-rpc case remote-curl: allow push options Documentation/git-send-pack.txt

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