[PATCH v10 6/6] http: respect protocol.*.allow=user for http-alternates

2016-12-14 Thread Brandon Williams
From: Jeff King The http-walker may fetch the http-alternates (or alternates) file from a remote in order to find more objects. This should count as a "not from the user" use of the protocol. But because we implement the redirection ourselves and feed the new URL to curl, it will use the CURLOPT_

[PATCH v10 0/6] transport protocol policy configuration

2016-12-14 Thread Brandon Williams
respect configured protocol policies. Brandon Williams (5): lib-proto-disable: variable name fix http: always warn if libcurl version is too old transport: add protocol policy config option http: create function to get curl allowed protocols transport: add from_user parameter to

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

2016-12-14 Thread Brandon Williams
M_USER` to determine if the protocol came from the user. Signed-off-by: Brandon Williams --- http.c| 14 +++--- t/t5812-proto-disable-http.sh | 7 +++ transport.c | 8 +--- transport.h | 13 ++--- 4 files c

[PATCH v10 1/6] lib-proto-disable: variable name fix

2016-12-14 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: [PATCHv3 3/4] submodule: add flags to ok_to_remove_submodule

2016-12-14 Thread Brandon Williams
ered differently. -- Brandon Williams

[PATCH v7 2/7] submodules: add helper to determine if a submodule is initialized

2016-12-16 Thread Brandon Williams
Add the `is_submodule_initialized()` helper function to submodules.c. `is_submodule_initialized()` performs a check to determine if the submodule at the given path has been initialized. Signed-off-by: Brandon Williams --- submodule.c | 23 +++ submodule.h | 1 + 2 files

[PATCH v7 0/7] recursively grep across submodules

2016-12-16 Thread Brandon Williams
at it won't run on windows. This is due to testing if colons in filenames are still handled correctly, yet windows doesn't allow colons in filenames. Brandon Williams (7): submodules: add helper to determine if a submodule is populated submodules: add helper to determine if a

[PATCH v7 3/7] submodules: load gitmodules file from commit sha1

2016-12-16 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 v7 5/7] grep: optionally recurse into submodules

2016-12-16 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, 386 insertions(+), 20 dele

[PATCH v7 4/7] grep: add submodules as a grep source type

2016-12-16 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 v7 6/7] grep: enable recurse-submodules to work on objects

2016-12-16 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 | 76 --- t/t7814-grep-recurse-sub

[PATCH v7 7/7] grep: search history of moved submodules

2016-12-16 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 | 20 +-- t/t7814-grep-recurse-submodules.sh | 41 ++ 2 files changed, 59 insertio

[PATCH v7 1/7] submodules: add helper to determine if a submodule is populated

2016-12-16 Thread Brandon Williams
Add the `is_submodule_populated()` helper function to submodules.c. `is_submodule_populated()` performes a check to see if a submodule has been checkout out (and has a valid .git directory/file) at the given path. Signed-off-by: Brandon Williams --- submodule.c | 15 +++ submodule.h

[PATCH 0/3] push only submodules

2016-12-19 Thread Brandon Williams
nt 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. Brandon Williams (3): transport: refactor flag #defines to be more readable submodules: add RECURSE_SUBMODULES_ONLY value push: add

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

2016-12-19 Thread Brandon Williams
makes the defines easier to read. Signed-off-by: Brandon Williams --- 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/transport.h @@ -131,21 +131,21

[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 --- submodule-config.c | 2 ++ submodule.h

[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 --- builtin/push.c | 2 ++ t/t5531-deep-submodule

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

2016-12-19 Thread Brandon Williams
t; void remove_untracked_cache(struct index_state *istate); > extern void connect_work_tree_and_git_dir(const char *work_tree, const char > *git_dir); > -extern void relocate_gitdir(const char *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
nd.h > @@ -56,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

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

2016-12-21 Thread Brandon Williams
uf_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 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

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

2016-12-28 Thread Brandon Williams
;& > + item->prefix <= item->len) > + die (_("Path leads inside submodule '%s', but the submodule " > +"was not recognized, i.e. not initialized or deleted"), > + ce->name); > return magic; I haven't been following everything on the list these past couple days, but are we sure this is caused by submodules? Also variable 'ce' shouldn't be in scope here. -- Brandon Williams

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

2016-12-28 Thread Brandon Williams
nitialized 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: 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: What's cooking in git.git (Dec 2016, #08; Tue, 27)

2017-01-03 Thread Brandon Williams
On 01/03, Duy Nguyen wrote: > On Thu, Dec 29, 2016 at 5:06 PM, Duy Nguyen wrote: > > On Thu, Dec 29, 2016 at 1:18 AM, Brandon Williams wrote: > >> On 12/27, Junio C Hamano wrote: > >>> * bw/pathspec-cleanup (2016-12-14) 16 commits > >>> - pathspec: re

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

2017-01-03 Thread Brandon Williams
On 01/03, Duy Nguyen wrote: > On Wed, Dec 14, 2016 at 6:14 AM, Brandon Williams wrote: > > @@ -340,8 +336,9 @@ static void NORETURN unsupported_magic(const char > > *pattern, > > continue; > > if (sb.len) > >

[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 --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 1df61f10f..e8

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

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

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

2017-01-03 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 2f43877bc..4e86dc523 100644 --- a/b

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

2017-01-03 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 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 --- 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 +++ b/

[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 --- pathspec.c | 68 ++ 1 file changed, 42 insertions(+), 26 deletions

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

2017-01-03 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 | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/pathspec.c b/paths

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

2017-01-03 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 v4 06/16] pathspec: copy and free owned memory

2017-01-03 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 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 --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/pathspec.c index f760f44f9

[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 --- pathspec.c | 25 +++-- 1 file changed, 15 insertions(+),

[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
vis-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 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 1/5] real_path: resolve symlinks by hand

2017-01-03 Thread Brandon Williams
aking real_path one step closer to being reentrant. Signed-off-by: Brandon Williams --- abspath.c | 188 ++ 1 file changed, 128 insertions(+), 60 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de859..0f34636a8 100644 --- a/absp

[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 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 --- abspath.c | 53

[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, the root part has

[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 --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c index c3a6acd4d..f4283f465 100644

[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 --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 13 - sha1_file.c | 2 +- submodule.c | 2

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

[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 --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/pathspec.c index ae9e1401f

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 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_away(const char *path, int &g

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 wrote: > > > diff --git a/dir.c b/dir.c > > > index 15f7c9993..e8ddd7f8a 100644 > > > --- a/dir.c > > > +++ b/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 --- pathspec.c | 25 +++-- 1 file changed, 15 insertions(+),

[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
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 | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/pathspec.c b/paths

[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 --- pathspec.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pathspec.c b/pathspec.c index 77df55da6

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

2017-01-04 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 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 ---

[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 --- pathspec.c | 68 ++ 1 file changed, 42 insertions(+), 26 deletions

[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 --- pathspec.c | 127 + 1 file changed, 78

[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 --- pathspec.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/pathspec.c b/pathspec.c index e53530e7a

[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

[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 --- builtin/ls-tree.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/ls-tree.c

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

2017-01-04 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 v5 01/16] mv: remove use of deprecated 'get_pathspec()'

2017-01-04 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 2f43877bc..4e86dc523 100644 --- a/b

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

2017-01-04 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 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 --- 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 +++ b/

[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 --- dir.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 9ae454dde..bc

[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

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 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 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, I'll f

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

2017-01-04 Thread Brandon Williams
structing a pathspec object probably isn't the best place for determining if 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
aking real_path one step closer to being reentrant. Signed-off-by: Brandon Williams --- abspath.c | 194 ++ 1 file changed, 133 insertions(+), 61 deletions(-) diff --git a/abspath.c b/abspath.c index 2825de859..629201e48 100644 --- a/absp

[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 --- builtin/init-db.c | 6 +++--- environment.c | 2 +- setup.c | 13 - sha1_file.c | 2 +- submodule.c | 2

[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 --- abspath.c | 13 + cache.h | 1 + 2 files changed, 14 insertions(+) diff --git a/abspath.c b/abspath.c index a200d4220..72f716f80 100644

[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_intern

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 wrote: > > On Wed, Jan 4, 2017 at 10:13 AM, Brandon Williams wrote: > >> On 01/04, Jeff King wrote: > >>> On Wed, Jan 04, 2017 at 07:56:02AM +0100, Torsten Bögershausen wrote: > &g

[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, the root part has

[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 --- abspath.c | 53

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

2017-01-04 Thread Brandon Williams
t; + > +TEST_CREATE_SUBMODULE=yes > +. ./test-lib.sh > + > +test_expect_success 'setup a submodule' ' > + git submodule add ./pretzel.bare sub && > + git commit -a -m "add submodule" && > + git submodule deinit --all > +' > + > +cat <expect > +fatal: Pathspec 'sub/a' 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 wrote: > > Changes in v5: > > * Move GUARD_PATHSPEC to prevent checking if pathspec is null twice. > > * Mark a string containing 'mnemonic' for translation. > > Argh.. I'v

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 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 fallback value

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 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 series which > &

[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 --- a

[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 --- abspath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/abspath.c b/abspath.c index 0393213e5..fce40fddc 100644 --- a/abspath.c

[PATCH] index: improve constness for reading blob data

2017-01-10 Thread Brandon Williams
Improve constness of the index_state parameter to the 'read_blob_data_from_index' function. Signed-off-by: Brandon Williams --- cache.h | 2 +- read-cache.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index a50a61a19..363953c1a 10

[PATCH 23/27] attr: remove maybe-real, maybe-macro from git_attr

2017-01-12 Thread Brandon Williams
y the attribute stack only needs to be scanned a single time prior to attribute collection instead of each time a macro needs to be expanded. Signed-off-by: Brandon Williams --- attr.c | 69 ++ attr.h | 6 ++ 2 files changed, 3

[PATCH 18/27] attr: retire git_check_attrs() API

2017-01-12 Thread Brandon Williams
From: Junio C Hamano Since nobody uses the old API, make it file-scope static, and update the documentation to describe the new API. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- Documentation/technical/api-gitattributes.txt | 86

[PATCH 19/27] attr: pass struct attr_check to collect_some_attrs

2017-01-12 Thread Brandon Williams
The old callchain used to take an array of attr_check_item items. Instead pass the 'attr_check' container object to 'collect_some_attrs()' and access the fields in the data structure directly. Signed-off-by: Brandon Williams --- attr.c | 33 +

[PATCH 17/27] attr: convert git_check_attrs() callers to use the new API

2017-01-12 Thread Brandon Williams
uct with data that can be used in optimizing the query for the specific N attributes it contains. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- archive.c | 24 ++-- builtin/pack-objects.c | 19 +-- co

[PATCH 15/27] attr: (re)introduce git_check_attr() and struct attr_check

2017-01-12 Thread Brandon Williams
names and initialize this structure. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- attr.c | 74 ++ attr.h | 17 +++ 2 files changed, 91 insertions(+) diff --git a/attr.

[PATCH 20/27] attr: change validity check for attribute names to use positive logic

2017-01-12 Thread Brandon Williams
y spell out what the rules for a good attribute name are, etc. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- attr.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/attr.c b/attr.c index

[PATCH 16/27] attr: convert git_all_attrs() to use "struct attr_check"

2017-01-12 Thread Brandon Williams
d() to add attribute names one by one. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- attr.c | 38 - attr.h | 9 +++- builtin/check-attr.c | 60 ++-

[PATCH 24/27] attr: tighten const correctness with git_attr and match_attr

2017-01-12 Thread Brandon Williams
Signed-off-by: Brandon Williams --- attr.c | 14 +++--- attr.h | 2 +- builtin/check-attr.c | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/attr.c b/attr.c index 633a12cc3..90f576044 100644 --- a/attr.c +++ b/attr.c @@ -209,7 +209,7

[PATCH 27/27] attr: reformat git_attr_set_direction() function

2017-01-12 Thread Brandon Williams
he attribute system and should be handled with care. Signed-off-by: Brandon Williams --- attr.c | 49 - attr.h | 3 ++- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/attr.c b/attr.c index cbb07d25d..f5cc68b67 100644 --- a/attr.c

[PATCH 25/27] attr: store attribute stacks in hashmap

2017-01-12 Thread Brandon Williams
g the info stack frame it needs to be its own isolated frame and can simply be processed first to have the same affect of being at the top of the stack. Signed-off-by: Brandon Williams --- attr.c | 375 + 1 file changed, 235 insertions(+

[PATCH 21/27] attr: use hashmap for attribute dictionary

2017-01-12 Thread Brandon Williams
essing the dictionary of interned attributes. Signed-off-by: Brandon Williams --- attr.c| 171 ++ attr.h| 2 + common-main.c | 3 ++ 3 files changed, 131 insertions(+), 45 deletions(-) diff --git a/attr.c b/attr.c index

[PATCH 22/27] attr: eliminate global check_all_attr array

2017-01-12 Thread Brandon Williams
ance which is then used in the attribute collection process. This brings the attribute system one step closer to being thread-safe. Signed-off-by: Brandon Williams --- attr.c | 114 +++-- attr.h | 2 ++ 2 files changed, 78 insert

[PATCH 26/27] attr: push the bare repo check into read_attr()

2017-01-12 Thread Brandon Williams
Push the bare repository check into the 'read_attr()' function. This avoids needing to have extra logic which creates an empty stack frame when inside a bare repo as a similar bit of logic already exists in the 'read_attr()' function. Signed-off-by: Brandon Willia

[PATCH 08/27] attr.c: tighten constness around "git_attr" structure

2017-01-12 Thread Brandon Williams
From: Junio C Hamano It holds an interned string, and git_attr_name() is a way to peek into it. Make sure the involved pointer types are pointer-to-const. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams --- attr.c | 2 +- attr.h | 4 ++-- 2 files

  1   2   3   4   5   6   7   8   9   10   >