Re: [PATCH] sha1_file: make read_info_alternates static

2017-08-15 Thread Brandon Williams
t; { > char *map; > size_t mapsz; > -- > 2.14.0.rc0.3.g6c2e499285 > Looks good to me. Only nit is I would fix the style to not have a space after the '*' ;) -- Brandon Williams

Re: [PATCH] convert add_to_alternates_file to use repository struct

2017-08-15 Thread Brandon Williams
(r, reference, strlen(reference), > + '\n', NULL, 0); > } > free(alts); > } > @@ -540,7 +545,8 @@ void add_to_alternates_memory(const char *reference) > */ > prepare_alt_odb(); > > - link_alt_odb_entries(reference, strlen(reference), '\n', NULL, 0); > + link_alt_odb_entries(the_repository, reference, strlen(reference), > + '\n', NULL, 0); > } > > /* > @@ -643,7 +649,8 @@ void prepare_alt_odb(void) > if (!alt) alt = ""; > > alt_odb_tail = _odb_list; > - link_alt_odb_entries(alt, strlen(alt), PATH_SEP, NULL, 0); > + link_alt_odb_entries(the_repository, alt, strlen(alt), > + PATH_SEP, NULL, 0); > > read_info_alternates(get_object_directory(), 0); > } > -- > 2.14.0.rc0.3.g6c2e499285 > -- Brandon Williams

Re: [PATCH v1 1/1] dir: teach status to show ignored directories

2017-08-11 Thread Brandon Williams
inds an untracked file. However, as > the directory is ignored, all the contained contents are also marked > excluded. For ignored directories that contain a large number of files, > this can take some time. > > Signed-off-by: Jameson Miller <jam...@microsoft.com> -- Brandon Williams

Re: [RFC] clang-format: outline the git project's coding style

2017-08-11 Thread Brandon Williams
do_not_close:1; > + unsigned pack_local : 1, > + pack_keep : 1, > + freshened : 1, > + do_not_close : 1; > unsigned char sha1[20]; > struct revindex_entry *revindex; > /* something like ".git/objects/pack/x.pack" */ > @@ -1767,10 +1767,10 @@ struct object_info { > union { > /* >* struct { > - * ... Nothing to expose in this case > + * ... Nothing to expose in this case >* } cached; >* struct { > - * ... Nothing to expose in this case > + * ... Nothing to expose in this case >* } loose; >*/ > struct { -- Brandon Williams

Re: [RFC] clang-format: outline the git project's coding style

2017-08-11 Thread Brandon Williams
not search enough, "clang-tidy-diff.py --fix" should be all that is > needed I believe clang-tidy is different from clang-format am I mistaken? -- Brandon Williams

Re: [PATCH v2 0/2] clang-format

2017-08-14 Thread Brandon Williams
On 08/14, Brandon Williams wrote: > Changes in v2: > * Changed a couple rules to be more inline with our coding style. > * Added a Makefile build rule to run git-clang-format on the diff of the >working tree to suggest style changes. > > I found that the llvm project also

[PATCH v2 1/2] clang-format: outline the git project's coding style

2017-08-14 Thread Brandon Williams
Add a '.clang-format' file which outlines the git project's coding style. This can be used with clang-format to auto-format .c and .h files to conform with git's style. Signed-off-by: Brandon Williams <bmw...@google.com> --- .clang-format

[PATCH v2 0/2] clang-format

2017-08-14 Thread Brandon Williams
. Brandon Williams (2): clang-format: outline the git project's coding style Makefile: add style build rule .clang-format | 165 ++ Makefile | 4 ++ 2 files changed, 169 insertions(+) create mode 100644 .clang-format

[PATCH v2 2/2] Makefile: add style build rule

2017-08-14 Thread Brandon Williams
Add the 'style' build rule which will run git-clang-format on the diff between HEAD and the current worktree. The result is a diff of suggested changes. Signed-off-by: Brandon Williams <bmw...@google.com> --- Makefile | 4 1 file changed, 4 insertions(+) diff --git a/Makefile b/Ma

Re: [PATCH v2 1/2] clang-format: outline the git project's coding style

2017-08-14 Thread Brandon Williams
On 08/14, Jeff King wrote: > On Mon, Aug 14, 2017 at 06:48:31PM -0400, Jeff King wrote: > > > On Mon, Aug 14, 2017 at 02:30:45PM -0700, Brandon Williams wrote: > > > > > +# Align escaped newlines as far left as possible > > > +# #define A \ >

Re: [PATCH v2 2/2] Makefile: add style build rule

2017-08-14 Thread Brandon Williams
by all contributors. Specifically the penalties to help determine when to break a line. > > > Anyway, we cannot have perfect checker from the day one, and > > considering this is an initial attempt, I'd say it is a good start. -- Brandon Williams

Re: [RFC] clang-format: outline the git project's coding style

2017-08-10 Thread Brandon Williams
On 08/10, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > On 08/10, Junio C Hamano wrote: > > > >> I vaguely recall that there was a discussion to have SubmitGit wait > >> for success from Travis CI; if that is already in place

Re: [RFC] clang-format: outline the git project's coding style

2017-08-10 Thread Brandon Williams
lowly the code base would begin to have a uniform style. At some point we may want to then reformat the remaining sections of the code base. At this point we could have some automated bot that fixes style. I'm sure I missed a step in there somewhere though. -- Brandon Williams

Re: [PATCH] RFC: Introduce '.gitorderfile'

2017-07-13 Thread Brandon Williams
d > more possible options into the .gitmodules file, now that we established > a strong stance on not shipping a project-level .gitconfig. I'm trying to work on cleaning up the submodule-config a bit and as a result I should be able to make it more difficult to ship more project-level configurations in .gitmodules -- Brandon Williams

Re: [PATCH 04/33] notes: make get_note return pointer to struct object_id

2017-07-17 Thread Brandon Williams
On 07/15, René Scharfe wrote: > Am 30.05.2017 um 19:30 schrieb Brandon Williams: > > @@ -392,7 +392,7 @@ static int add(int argc, const char **argv, const char > > *prefix) > > const char *object_ref; > > struct notes_tree *t; > > unsigned char object

Re: [RFC/WIP PATCH] object store classification

2017-07-11 Thread Brandon Williams
ros that allow you to operate on the fields of the default > > instance as if they were separate variables have been a huge > > typesaver that also reduces the cognitive burden. I'd expect that > > the same will hold for the new "repository" and the "object_store" > > abstractions. > > Sounds reasonable to expect. > > Thanks, > Stefan -- Brandon Williams

Re: [PATCH 1/7] api-builtin.txt: document SUPPORT_SUPER_PREFIX

2017-07-11 Thread Brandon Williams
On 07/11, Martin Ågren wrote: > On 11 July 2017 at 00:50, Brandon Williams <bmw...@google.com> wrote: > > On 07/10, Martin Ågren wrote: > >> Commit 74866d75 ("git: make super-prefix option", 2016-10-07) introduced > >> SUPPORT_SUPER_PREFIX as a buil

[PATCH 1/3] repo_read_index: don't discard the index

2017-07-11 Thread Brandon Williams
Have 'repo_read_index()' behave more like the other read_index family of functions and don't discard the index if it has already been populated. Signed-off-by: Brandon Williams <bmw...@google.com> --- repository.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/repository.c b/reposi

[PATCH 3/3] grep: recurse in-process using 'struct repository'

2017-07-11 Thread Brandon Williams
Convert grep to use 'struct repository' which enables recursing into submodules to be handled in-process. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 7 - builtin/grep.c | 390 + c

[PATCH 2/3] setup: have the_repository use the_index

2017-07-11 Thread Brandon Williams
Have the index state which is stored in 'the_repository' be a pointer to the in-core instead 'the_index'. This makes it easier to begin transitioning more parts of the code base to operate on a 'struct repository'. Signed-off-by: Brandon Williams <bmw...@google.com> --- setup.c | 1 +

[PATCH 0/3] Convert grep to recurse in-process

2017-07-11 Thread Brandon Williams
launched a process for operating on a submodule. Brandon Williams (3): repo_read_index: don't discard the index setup: have the_repository use the_index grep: recurse in-process using 'struct repository' Documentation/git-grep.txt | 7 - builtin/grep.c | 390

Re: [PATCH 1/7] api-builtin.txt: document SUPPORT_SUPER_PREFIX

2017-07-10 Thread Brandon Williams
o better document it until that happens? Either way I think that this sort of Documention better lives in the code as it is easier to keep up to date. Last time I tried to look at stuff in Documentation/technical the files were either place holders or completely out of date with what the code did. -- Brandon Williams

Re: [GSoC][PATCH 1/8] submodule--helper: introduce get_submodule_displaypath()

2017-07-10 Thread Brandon Williams
ive flag for the submodule being initialized >*/ > if (!is_submodule_active(the_repository, path)) { > - strbuf_reset(); Is this line removal intended? It doesn't look related to the rest of this patch. > strbuf_addf(, "submodule.%s.active", sub->name); > git_config_set_gently(sb.buf, "true"); > } > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 1/8] submodule--helper: introduce get_submodule_displaypath()

2017-07-10 Thread Brandon Williams
On 07/10, Stefan Beller wrote: > On Mon, Jul 10, 2017 at 4:32 PM, Brandon Williams <bmw...@google.com> wrote: > >> if (!is_submodule_active(the_repository, path)) { > >> - strbuf_reset(); > > > > Is this line removal intende

Re: [GSoC][PATCH 4/8] submodule: port submodule subcommand 'status' from shell to C

2017-07-10 Thread Brandon Williams
say "-$sha1 $displaypath" > - continue; > - fi > - if git diff-files --ignore-submodules=dirty --quiet -- > "$sm_path" > - then > - revname=$(git submodule--helper print-name-rev > "$sm_path" "$sha1") > - say " $sha1 $displaypath$revname" > - else > - if test -z "$cached" > - then > - sha1=$(sanitize_submodule_env; cd "$sm_path" && > git rev-parse --verify HEAD) > - fi > - revname=$(git submodule--helper print-name-rev > "$sm_path" "$sha1") > - say "+$sha1 $displaypath$revname" > - fi > - > - if test -n "$recursive" > - then > - ( > - prefix="$displaypath/" > - sanitize_submodule_env > - wt_prefix= > - cd "$sm_path" && > - eval cmd_status > - ) || > - die "$(eval_gettext "Failed to recurse into submodule > path '\$sm_path'")" > - fi > - done > + git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} > submodule--helper status ${GIT_QUIET:+--quiet} ${cached:+--cached} > ${recursive:+--recursive} "$@" > } > # > # Sync remote urls for submodules > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 5/8] submodule: port submodule subcommand 'sync' from shell to C

2017-07-10 Thread Brandon Williams
gin_url=$(git submodule--helper > resolve-relative-url "$url" "$up_path") && > - # path from superproject work tree to submodule origin > repo > - super_config_url=$(git submodule--helper > resolve-relative-url "$url") || exit > - ;; > - *) > - sub_origin_url="$url" > - super_config_url="$url" > - ;; > - esac > > - displaypath=$(git submodule--helper relative-path > "$prefix$sm_path" "$wt_prefix") > - say "$(eval_gettext "Synchronizing submodule url for > '\$displaypath'")" > - git config submodule."$name".url "$super_config_url" > - > - if test -e "$sm_path"/.git > - then > - ( > - sanitize_submodule_env > - cd "$sm_path" > - remote=$(get_default_remote) > - git config remote."$remote".url "$sub_origin_url" > + git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} > submodule--helper sync ${GIT_QUIET:+--quiet} ${recursive:+--recursive} "$@" > > - if test -n "$recursive" > - then > - prefix="$prefix$sm_path/" > - eval cmd_sync > - fi > - ) > - fi > - done > } > > cmd_absorbgitdirs() > -- > 2.13.0 > -- Brandon Williams

Re: [PATCH] strbuf: use designated initializers in STRBUF_INIT

2017-07-10 Thread Brandon Williams
har strbuf_slopbuf[]; > -#define STRBUF_INIT { 0, 0, strbuf_slopbuf } > +#define STRBUF_INIT { .alloc = 0, .len = 0, .buf = strbuf_slopbuf } I love that this is happening! And maybe someday soon we can do: for (int i = 0; i < n; i++) So that we can scope loop variables to the loops themselves. -- Brandon Williams

Re: [PATCH 1/3] repo_read_index: don't discard the index

2017-07-12 Thread Brandon Williams
On 07/11, Stefan Beller wrote: > On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams <bmw...@google.com> wrote: > > Have 'repo_read_index()' behave more like the other read_index family of > > functions and don't discard the index if it has already been populated. > >

Re: [PATCH 1/3] repo_read_index: don't discard the index

2017-07-12 Thread Brandon Williams
On 07/11, Jonathan Nieder wrote: > Brandon Williams wrote: > > > Have 'repo_read_index()' behave more like the other read_index family of > > functions and don't discard the index if it has already been populated. > > > > Signed-off-by: Brand

Re: [PATCH 2/3] setup: have the_repository use the_index

2017-07-12 Thread Brandon Williams
On 07/11, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Have the index state which is stored in 'the_repository' be a pointer to > > the in-core instead 'the_index'. This makes it easier to begin > > transitioning more parts of the cod

Re: [PATCH 0/3] Convert grep to recurse in-process

2017-07-12 Thread Brandon Williams
On 07/12, Jeff King wrote: > On Tue, Jul 11, 2017 at 03:04:05PM -0700, Brandon Williams wrote: > > > This series utilizes the new 'struct repository' in order to convert grep > > to be > > able to recurse into submodules in-process much like how ls-files was >

Re: [PATCH 2/3] setup: have the_repository use the_index

2017-07-12 Thread Brandon Williams
On 07/11, Jonathan Nieder wrote: > Hi, > > Brandon Williams wrote: > > > Have the index state which is stored in 'the_repository' be a pointer to > > the in-core instead 'the_index'. This makes it easier to begin > > transitioning more parts of the cod

[PATCH v2 2/3] repository: have the_repository use the_index

2017-07-14 Thread Brandon Williams
Have the index state which is stored in 'the_repository' be a pointer to the in-core index 'the_index'. This makes it easier to begin transitioning more parts of the code base to operate on a 'struct repository'. Signed-off-by: Brandon Williams <bmw...@google.com> --- repository.c | 4 +

[PATCH v2 1/3] repo_read_index: don't discard the index

2017-07-14 Thread Brandon Williams
xxx */ if (istate->initialized) return istate->cache_nr; Signed-off-by: Brandon Williams <bmw...@google.com> --- repository.c | 2 -- repository.h | 8 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/repository.c b/repository.c index edca90740..8e60af1d5 100644 ---

[PATCH v2 0/3] Convert grep to recurse in-process

2017-07-14 Thread Brandon Williams
one as a static initializer. Brandon Williams (3): repo_read_index: don't discard the index repository: have the_repository use the_index grep: recurse in-process using 'struct repository' Documentation/git-grep.txt | 7 - builtin/grep.c |

[PATCH v2 3/3] grep: recurse in-process using 'struct repository'

2017-07-14 Thread Brandon Williams
Convert grep to use 'struct repository' which enables recursing into submodules to be handled in-process. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 7 - builtin/grep.c | 396 ++--- c

Re: [PATCH v2 00/13] object_id part 9

2017-07-14 Thread Brandon Williams
gt; submodule-config.h | 12 +- > submodule.c | 32 +++--- > submodule.h | 2 +- > t/helper/test-submodule-config.c | 10 +- > transport-helper.c | 2 +- > 39 files changed, 351 insertions(+), 360 deletions(-) > -- Brandon Williams

Re: Fwd: New Defects reported by Coverity Scan for git

2017-07-18 Thread Brandon Williams
gt; (/home/gitster/git.git/builtin/grep.c:422) > ==20383==by 0x4348C8: grep_tree (/home/gitster/git.git/builtin/grep.c:580) > ==20383==by 0x434867: grep_tree (/home/gitster/git.git/builtin/grep.c:576) > ==20383==by 0x436034: cmd_grep (/home/gitster/git.git/builtin/grep.c:622) > ==20383==by 0x4063DC: handle_builtin (/home/gitster/git.git/git.c:330) > ==20383== Address 0x0 is not stack'd, malloc'd or (recently) free'd > > -- Brandon Williams

Re: [PATCH v3 00/10] Convert grep to recurse in-process

2017-07-18 Thread Brandon Williams
On 07/18, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Changes in v3: > > * Fixes a bug with repo_read_gitmodules() where it was possible to > >segfault when a repository didn't have a worktree. > > * In order to fi

[PATCH v3 07/10] submodule: check for unstaged .gitmodules outside of config parsing

2017-07-18 Thread Brandon Williams
Teach 'is_staging_gitmodules_ok()' to be able to determine in the '.gitmodules' file has unstaged changes based on the passed in index instead of relying on a global varible which is set during the submodule-config parsing. Signed-off-by: Brandon Williams <bmw...@google.com> --- builti

[PATCH v3 09/10] submodule: merge repo_read_gitmodules and gitmodules_config

2017-07-18 Thread Brandon Williams
. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/submodule.c b/submodule.c index a5f825e37..ab0b74926 100644 --- a/submodule.c +++ b/submodule.c @@ -230,23 +230,6 @

Re: [PATCH] objects: scope count variable to loop

2017-07-19 Thread Brandon Williams
s = array->objects; > > array->nr = 0; > - for (src = 0; src < nr; src++) { > + for (unsigned src = 0; src < nr; src++) { > if (!contains_name(array, objects[src].name)) { > if (src != array->nr) > objects[array->nr] = objects[src]; > -- > 2.14.0.rc0.3.g6c2e499285 > -- Brandon Williams

[PATCH v3 08/10] submodule: check for unmerged .gitmodules outside of config parsing

2017-07-18 Thread Brandon Williams
Add 'is_gitmodules_unmerged()' function which can be used to determine in the '.gitmodules' file is unmerged based on the passed in index instead of relying on a global variable which is set during the submodule-config parsing. Signed-off-by: Brandon Williams <bmw...@google.com> --- submo

[PATCH v3 05/10] submodule: remove submodule.fetchjobs from submodule-config parsing

2017-07-18 Thread Brandon Williams
. Remove the 'submodule.fetchjobs' configuration option from the general submodule-config parsing and instead rely on using the 'config_from_gitmodules()' in order to maintain backwards compatibility with this config being placed in the '.gitmodules' file. Signed-off-by: Brandon Williams <

[PATCH v3 10/10] grep: recurse in-process using 'struct repository'

2017-07-18 Thread Brandon Williams
Convert grep to use 'struct repository' which enables recursing into submodules to be handled in-process. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/git-grep.txt | 7 - builtin/grep.c | 396 ++--- c

[PATCH v3 06/10] submodule: remove fetch.recursesubmodules from submodule-config parsing

2017-07-18 Thread Brandon Williams
Remove the 'fetch.recursesubmodules' configuration option from the general submodule-config parsing and instead rely on using 'config_from_gitmodules()' in order to maintain backwards compatibility with this config being placed in the '.gitmodules' file. Signed-off-by: Brandon Williams <

[PATCH v3 02/10] repository: have the_repository use the_index

2017-07-18 Thread Brandon Williams
Have the index state which is stored in 'the_repository' be a pointer to the in-core index 'the_index'. This makes it easier to begin transitioning more parts of the code base to operate on a 'struct repository'. Signed-off-by: Brandon Williams <bmw...@google.com> --- repository.c | 4 +

[PATCH v3 00/10] Convert grep to recurse in-process

2017-07-18 Thread Brandon Williams
this will be added to .gitmodules in the future. Brandon Williams (10): repo_read_index: don't discard the index repository: have the_repository use the_index cache.h: add GITMODULES_FILE macro config: add config_from_gitmodules submodule: remove submodule.fetchjobs from submodule-config parsing

[PATCH v3 04/10] config: add config_from_gitmodules

2017-07-18 Thread Brandon Williams
anywhere other than in 'fetch' and 'update_clone'. Signed-off-by: Brandon Williams <bmw...@google.com> --- config.c | 17 + config.h | 10 ++ 2 files changed, 27 insertions(+) diff --git a/config.c b/config.c index 231f9a750..06645a325 100644 --- a/config.c +++ b/co

[PATCH v3 03/10] cache.h: add GITMODULES_FILE macro

2017-07-18 Thread Brandon Williams
Add a macro to be used when specifying the '.gitmodules' file. Signed-off-by: Brandon Williams <bmw...@google.com> --- cache.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cache.h b/cache.h index 71fe09264..d59f767e2 100644 --- a/cache.h +++ b/cache.h @@ -433,6 +433,7 @@ static

[PATCH v3 01/10] repo_read_index: don't discard the index

2017-07-18 Thread Brandon Williams
xxx */ if (istate->initialized) return istate->cache_nr; Signed-off-by: Brandon Williams <bmw...@google.com> --- repository.c | 2 -- repository.h | 8 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/repository.c b/repository.c index edca90740..8e60af1d5 100644 ---

[PATCH v2 1/1] submodule--helper: teach push-check to handle HEAD

2017-07-20 Thread Brandon Williams
checked out and the submodule is not in a detached head state. Signed-off-by: Brandon Williams <bmw...@google.com> --- Changes in V2: * fixed a few style issues * shifted argv/argc to prevent more damage to the code than is necessary. builtin/submodule--helper.c

Re: [PATCH 03/15] add, reset: ensure submodules can be added or reset

2017-07-25 Thread Brandon Williams
On 07/25, Stefan Beller wrote: > On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmw...@google.com> wrote: > > Commit aee9c7d65 (Submodules: Add the new "ignore" config option for > > diff and status) ... > > introduced in 2010, so quite widely spre

Re: [PATCH 05/15] submodule--helper: don't overlay config in update-clone

2017-07-25 Thread Brandon Williams
On 07/25, Stefan Beller wrote: > On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmw...@google.com> wrote: > > Don't rely on overlaying the repository's config on top of the > > submodule-config, instead query the repository's config directly for the > >

Re: [PATCH 06/15] fetch: don't overlay config with submodule-config

2017-07-25 Thread Brandon Williams
On 07/25, Stefan Beller wrote: > On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmw...@google.com> wrote: > > Don't rely on overlaying the repository's config on top of the > > submodule-config, instead query the repository's config directly for the > > fetch_recurs

Re: [PATCH v2 2/2] sub-process: refactor handshake to common function

2017-07-25 Thread Brandon Williams
s" section of the gitattributes documentation using > the > + * given requested versions and capabilities. The "versions" and > "capabilities" > + * parameters are arrays terminated by a 0 or blank struct. > + * > + * This function is typically called when a subprocess is started (as part of > + * the "startfn" passed to subprocess_start). > + */ > +int subprocess_handshake(struct subprocess_entry *entry, > + const char *welcome_prefix, > + int *versions, > + int *chosen_version, > + struct subprocess_capability *capabilities, > + unsigned int *supported_capabilities); > + > /* > * Helper function that will read packets looking for "status=" > * key/value pairs and return the value from the last "status" packet > diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh > index 161f56044..d191a7228 100755 > --- a/t/t0021-conversion.sh > +++ b/t/t0021-conversion.sh > @@ -697,7 +697,7 @@ test_expect_success PERL 'invalid process filter must > fail (and not hang!)' ' > > cp "$TEST_ROOT/test.o" test.r && > test_must_fail git add . 2>git-stderr.log && > - grep "does not support filter protocol version" git-stderr.log > + grep "expected git-filter-server" git-stderr.log > ) > ' > > -- > 2.14.0.rc0.400.g1c36432dff-goog > -- Brandon Williams

Re: [PATCH v2 1/2] Documentation: migrate sub-process docs to header

2017-07-25 Thread Brandon Williams
t hashmap *hashmap, struct subprocess_entry > *entry); > > +/* Find a subprocess in the subprocess hashmap. */ > struct subprocess_entry *subprocess_find_entry(struct hashmap *hashmap, > const char *cmd); > > /* subprocess helper functions */ > > +/* Get the underlying `struct child_process` from a subprocess. */ > static inline struct child_process *subprocess_get_child_process( > struct subprocess_entry *entry) > { > -- > 2.14.0.rc0.400.g1c36432dff-goog > -- Brandon Williams

Re: recursive grep doesn't respect --color=always inside submodules

2017-07-24 Thread Brandon Williams
he series to implement this is currently under-review. The latest version of the patch series you can find here (https://public-inbox.org/git/20170718190527.78049-1-bmw...@google.com/) and it looks like Junio has it as a branch on github at (https://github.com/gitster/git/tree/bw/grep-recurse-submodules). -- Brandon Williams

[PATCH 02/15] submodule: don't use submodule_from_name

2017-07-25 Thread Brandon Williams
-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/submodule.c b/submodule.c index 7e87e4698..fd391aea6 100644 --- a/submodule.c +++ b/submodule.c @@ -1177,8 +1177,6 @@ static int get_next_submodule(struct child_proce

[PATCH 00/15] submodule-config cleanup

2017-07-25 Thread Brandon Williams
sense in the context of a checkout or reset. If that's the case then we can make the parts of the code which use 'update' even simpler. This series is built on and requires the 'bw/grep-recurse-submodules' and 'bc/object-id' branches. Brandon Williams (15): t7411: check configuration parsing errors

[PATCH 04/15] submodule--helper: don't overlay config in remote_submodule_branch

2017-07-25 Thread Brandon Williams
Don't rely on overlaying the repository's config on top of the submodule-config, instead query the repository's config directly for the branch field. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/submodule--helper.c | 15 +++ 1 file changed, 11 insertions

[PATCH 09/15] submodule: remove submodule_config callback routine

2017-07-25 Thread Brandon Williams
of the submodule-config. This also makes it more difficult to accidentally add non-submodule specific configuration to the .gitmodules file. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/submodule--helper.c | 1 - submodule.c | 25 ++--- submo

[PATCH 08/15] unpack-trees: don't rely on overlayed config

2017-07-25 Thread Brandon Williams
logic (checkout, read-tree, reset). Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/checkout.c | 2 +- submodule.c| 1 - unpack-trees.c | 12 +--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c

[PATCH 15/15] submodule: remove gitmodules_config

2017-07-25 Thread Brandon Williams
Now that the submodule-config subsystem can lazily read the gitmodules file we no longer need to explicitly pre-read the gitmodules by calling 'gitmodules_config()' so let's remove it. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/checkout.c | 1 - b

[PATCH 05/15] submodule--helper: don't overlay config in update-clone

2017-07-25 Thread Brandon Williams
Don't rely on overlaying the repository's config on top of the submodule-config, instead query the repository's config directly for the url and the update strategy configuration. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/submodule--helper.c | 14 ++ submo

[PATCH 12/15] submodule-config: move submodule-config functions to submodule-config.c

2017-07-25 Thread Brandon Williams
Migrate the functions used to initialize the submodule-config to submodule-config.c so that the callback routine used in the initialization process can be static and prevent it from being used outside of initializing the submodule-config through the main API. Signed-off-by: Brandon Williams <

[PATCH 06/15] fetch: don't overlay config with submodule-config

2017-07-25 Thread Brandon Williams
Don't rely on overlaying the repository's config on top of the submodule-config, instead query the repository's config directly for the fetch_recurse field. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/fetch.c | 1 - submodule.c | 24 +--- 2

[PATCH 03/15] add, reset: ensure submodules can be added or reset

2017-07-25 Thread Brandon Williams
g. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/add.c | 1 + builtin/reset.c | 1 + 2 files changed, 2 insertions(+) diff --git a/builtin/add.c b/builtin/add.c index e888fb8c5..6f271512f 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -116,6 +116,7 @@ int add_file

[PATCH 01/15] t7411: check configuration parsing errors

2017-07-25 Thread Brandon Williams
Check for configuration parsing errors in '.gitmodules' in t7411, which is explicitly testing the submodule-config subsystem, instead of in t7400. Also explicitly use the test helper instead of relying on the gitmodules file from being read in status. Signed-off-by: Brandon Williams <

[PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts

2017-07-25 Thread Brandon Williams
Don't rely on overlaying the repository's config on top of the submodule-config, instead query the repository's config directory for the ignore field. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-)

[PATCH 10/15] diff: stop allowing diff to have submodules configured in .git/config

2017-07-25 Thread Brandon Williams
to be consistent with how the submodule-config is populated, via calling 'gitmodules_config()' or 'repo_read_gitmodules()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- diff.c| 3 --- t/t4027-diff-submodule.sh | 67

[PATCH 13/15] submodule-config: lazy-load a repository's .gitmodules file

2017-07-25 Thread Brandon Williams
the submodule-config system before using it, so instead let's perform lazy-loading of the submodule-config system. Remove the calls to reading the gitmodules file from ls-files to show that lazy-loading the .gitmodules file works. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/ls-f

[PATCH 11/15] submodule-config: remove support for overlaying repository config

2017-07-25 Thread Brandon Williams
All callers have been migrated to explicitly read any configuration they need. The support for handling it automatically in submodule-config is no longer needed. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule-config.h | 1 - t/helper/test-submodule-co

[PATCH 14/15] unpack-trees: improve loading of .gitmodules

2017-07-25 Thread Brandon Williams
. Because of this let's not rely on callers of 'check_updates()' to read the gitmodules file before calling 'check_updates()' and handle the reading explicitly. Signed-off-by: Brandon Williams <bmw...@google.com> --- unpack-trees.c | 42 ++ 1 file c

Re: [GSoC][PATCH 04/13] submodule: port submodule subcommand 'status' from shell to C

2017-07-24 Thread Brandon Williams
-ignore-submodules=dirty --quiet -- > "$sm_path" > - then > - revname=$(git submodule--helper print-name-rev > "$sm_path" "$sha1") > - say " $sha1 $displaypath$revname" > - else > - if test -z "$cached" > - then > - sha1=$(sanitize_submodule_env; cd "$sm_path" && > git rev-parse --verify HEAD) > - fi > - revname=$(git submodule--helper print-name-rev > "$sm_path" "$sha1") > - say "+$sha1 $displaypath$revname" > - fi > - > - if test -n "$recursive" > - then > - ( > - prefix="$displaypath/" > - sanitize_submodule_env > - wt_prefix= > - cd "$sm_path" && > - eval cmd_status > - ) || > - die "$(eval_gettext "Failed to recurse into submodule > path '\$sm_path'")" > - fi > - done > + git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} > submodule--helper status ${GIT_QUIET:+--quiet} ${cached:+--cached} > ${recursive:+--recursive} "$@" > } > # > # Sync remote urls for submodules > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 03/13] submodule: port set_name_rev() from shell to C

2017-07-24 Thread Brandon Williams
= get_name_rev(argv[1], argv[2]); > + if (namerev && namerev[0]) > + printf(" (%s)", namerev); > + printf("\n"); > + 'namerev' needs to be freed at the end of this function. > + return 0; > +} > + -- Brandon Williams

Re: [GSoC][PATCH 06/13] submodule: port submodule subcommand 'deinit' from shell to C

2017-07-24 Thread Brandon Williams
die "$(eval_gettext "Submodule work tree > '\$displaypath' contains local modifications; use '-f' to discard them")" > - fi > - rm -rf "$sm_path" && > - say "$(eval_gettext "Cleared directory > '\$displaypath'")" || > - say "$(eval_gettext "Could not remove submodule work > tree '\$displaypath'")" > - fi > - > - mkdir "$sm_path" || say "$(eval_gettext "Could not create empty > submodule directory '\$displaypath'")" > - > - # Remove the .git/config entries (unless the user already did > it) > - if test -n "$(git config --get-regexp submodule."$name\.")" > - then > - # Remove the whole section so we have a clean state when > - # the user later decides to init this submodule again > - url=$(git config submodule."$name".url) > - git config --remove-section submodule."$name" > 2>/dev/null && > - say "$(eval_gettext "Submodule '\$name' (\$url) > unregistered for path '\$displaypath'")" > - fi > - done > + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit > ${GIT_QUIET:+--quiet} ${prefix:+--prefix "$prefix"} ${force:+--force} > ${deinit_all:+--all} "$@" > } > > is_tip_reachable () ( > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 05/13] submodule: port submodule subcommand 'sync' from shell to C

2017-07-24 Thread Brandon Williams
- sub_origin_url=$(git submodule--helper > resolve-relative-url "$url" "$up_path") && > - # path from superproject work tree to submodule origin > repo > - super_config_url=$(git submodule--helper > resolve-relative-url "$url") || exit > - ;; > - *) > - sub_origin_url="$url" > - super_config_url="$url" > - ;; > - esac > > - displaypath=$(git submodule--helper relative-path > "$prefix$sm_path" "$wt_prefix") > - say "$(eval_gettext "Synchronizing submodule url for > '\$displaypath'")" > - git config submodule."$name".url "$super_config_url" > - > - if test -e "$sm_path"/.git > - then > - ( > - sanitize_submodule_env > - cd "$sm_path" > - remote=$(get_default_remote) > - git config remote."$remote".url "$sub_origin_url" > + git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} > submodule--helper sync ${GIT_QUIET:+--quiet} ${recursive:+--recursive} "$@" > > - if test -n "$recursive" > - then > - prefix="$prefix$sm_path/" > - eval cmd_sync > - fi > - ) > - fi > - done > } > > cmd_absorbgitdirs() > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 13/13] submodule: port submodule subcommand 'foreach' from shell to C

2017-07-24 Thread Brandon Williams
s argv_array structure. Other required arguments and the > input of submodule-foreach is also appended to this argv_array. > > Helped-by: Brandon Williams <bmw...@google.com> > Mentored-by: Christian Couder <christian.cou...@gmail.com> > Mentored-by: St

Re: [GSoC][PATCH 09/13] submodule foreach: correct '$path' in nested submodules from a subdirectory

2017-07-24 Thread Brandon Williams
Entering '../nested1/nested2/nested3' > +$pwd/clone2/nested1/nested2-nested3-nested3-$nested3sha1 > +Entering '../nested1/nested2/nested3/submodule' > +$pwd/clone2/nested1/nested2/nested3-submodule-submodule-$submodulesha1 > +Entering '../sub1' > +$pwd/clone2-foo1-sub1-$sub1sha1 > +Entering '../sub2' > +$pwd/clone2-foo2-sub2-$sub2sha1 > +Entering '../sub3' > +$pwd/clone2-foo3-sub3-$sub3sha1 > +EOF > + > +test_expect_success 'test "submodule foreach --recursive" from subdirectory' > ' > + ( > + cd clone2/untracked && > + git submodule foreach --recursive "echo > \$toplevel-\$name-\$sm_path-\$sha1" >../../actual > + ) && > + test_i18ncmp expect actual > +' > > cat > expect < nested1-nested1 > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 10/13] submodule foreach: document '$sm_path' instead of '$path'

2017-07-24 Thread Brandon Williams
e is now a deprecated synonym of '$sm_path' variable. > Any submodules defined in the superproject but not checked out are > ignored by this command. Unless given `--quiet`, foreach prints the name > of each submodule before evaluating the command. > -- > 2.13.0 > -- Brandon Williams

Re: [GSoC][PATCH 08/13] submodule: port submodule subcommand 'summary' from shell to C

2017-07-24 Thread Brandon Williams
[]"), > + NULL > + }; > + > + argc = parse_options(argc, argv, prefix, module_summary_options, > + git_submodule_helper_usage, 0); > + > + if (!summary_limits) > + return 0; > + > + cp_rev.git_cmd = 1; > + argv_array_pushl(_rev.args, "rev-parse", "-q", "--verify", > + argc ? argv[0] : "HEAD", NULL); > + > + if (!capture_command(_rev, , 0)) { > + strbuf_strip_suffix(, "\n"); > + if (argc) { > + argv++; > + argc--; > + } > + } else if (!argc || !strcmp(argv[0], "HEAD")) { > + /* before the first commit: compare with an empty tree */ > + struct stat st; > + unsigned char sha1[20]; Use a 'struct object_id' here. There's no reason to use sha1's 20 char arrays anymore. If you need to use a call that takes an unsigned char array you can always pass oid.hash. This limits the amount of conversion we'll have to do later. > + if (fstat(0, ) < 0 || index_fd(sha1, 0, , 2, prefix, 3)) What's the reasoning behind the fstat and index_fd call? Not saying they aren't needed I just need more context to understand whats going on. > + die("Unable to add %s to database", sha1); > + strbuf_addstr(, sha1_to_hex(sha1)); > + if (argc) { > + argv++; > + argc--; > + } > + } else { > + strbuf_addstr(, "HEAD"); > + } > + > + head = strbuf_detach(, NULL); So head is a 'char *' and it is never freed. You should free it at the end of this function to prevent memleaks. > + > + if (files) { > + if (cached) > + die(_("The --cached option cannot be used with the > --files option")); > + diff_cmd = "diff-files"; > + head = NULL; If you are assigning NULL here make sure that you free head first as you could have allocated memory which head is already pointing to. > + } > + > + info.argc = argc; > + info.argv = argv; > + info.prefix = prefix; > + info.cached = cached; > + info.for_status = for_status; > + info.quiet = quiet; > + info.files = files; > + info.summary_limits = summary_limits; > + info.diff_cmd = diff_cmd; You aren't doing the '!!' trick here like you did in the other patches. Any reason for that? > + > + return compute_summary_module_list(head, ); > +} > + -- Brandon Williams

Re: [GSoC][PATCH 12/13] submodule foreach: document variable '$displaypath'

2017-07-24 Thread Brandon Williams
../sub3-$sub3sha1 > EOF > > test_expect_success 'test "submodule foreach --recursive" from subdirectory' > ' > ( > cd clone2/untracked && > - git submodule foreach --recursive "echo > \$toplevel-\$name-\$sm_path-\$sha1" >../../actual > + git submodule foreach --recursive "echo > \$toplevel-\$name-\$sm_path-\$displaypath-\$sha1" >../../actual > ) && > test_i18ncmp expect actual > ' > -- > 2.13.0 > -- Brandon Williams

Re: [PATCH 3/3] grep: recurse in-process using 'struct repository'

2017-07-12 Thread Brandon Williams
On 07/11, Jacob Keller wrote: > On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams <bmw...@google.com> wrote: > > Convert grep to use 'struct repository' which enables recursing into > > submodules to be handled in-process. > > > > Signed-off-by: Br

Re: [PATCH 3/3] grep: recurse in-process using 'struct repository'

2017-07-12 Thread Brandon Williams
On 07/11, Jonathan Nieder wrote: > Hi, > > Brandon Williams wrote: > > > Convert grep to use 'struct repository' which enables recursing into > > submodules to be handled in-process. > > \o/ > > This will be even nicer with the changes describ

Re: [PATCH 3/3] grep: recurse in-process using 'struct repository'

2017-07-12 Thread Brandon Williams
On 07/11, Stefan Beller wrote: > On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams <bmw...@google.com> wrote: > > > + if (repo_submodule_init(, superproject, path)) > > + return 0; > > What happens if we go through the "return 0"

[PATCH v8 1/2] run-command: expose is_executable function

2017-04-25 Thread Brandon Williams
Move the logic for 'is_executable()' from help.c to run_command.c and expose it so that callers from outside help.c can access the function. This is to enable run-command to be able to query if a file is executable in a future patch. Signed-off-by: Brandon Williams <bmw...@google.com> ---

[PATCH v8 2/2] run-command: restrict PATH search to executable files

2017-04-25 Thread Brandon Williams
d-by: Brian Hatfield <bhatfi...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- run-command.c | 19 ++- t/t0061-run-command.sh | 30 ++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/run-command.c

Re: BUG: wildmatches like foo/**/**/bar don't match properly due to internal optimizations

2017-04-26 Thread Brandon Williams
on the submodule unless the first part of the pattern matches the submodule. Right now with recursive grep, if wildcards are used then the code just punts and says "yeah this pattern may match something in the submodule but we won't know for sure till we actually try". -- Brandon Williams

[PATCH v9 2/2] run-command: restrict PATH search to executable files

2017-04-26 Thread Brandon Williams
matches what 'execvp()' would have done with a request to execute 'git-hello' with such a $PATH. Reported-by: Brian Hatfield <bhatfi...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- This [2/2] patch has the exact same diff as v8, the only difference is to the commit me

Re: [PATCH v3 4/5] clone: add a --no-tags-submodules to pass --no-tags to submodules

2017-04-27 Thread Brandon Williams
On 04/26, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason <ava...@gmail.com> writes: > > > From: Brandon Williams <bmw...@google.com> > > > > Add a --no-tags-submodules which does for --no-tags what the existing > > --shallow-submodules does for

[PATCH v7 2/2] run-command: don't try to execute directories

2017-04-25 Thread Brandon Williams
d-by: Brian Hatfield <bhatfi...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- run-command.c | 2 +- t/t0061-run-command.sh | 23 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/run-command.c b/run-command.c index a97d7

[PATCH v7 1/2] exec_cmd: expose is_executable function

2017-04-25 Thread Brandon Williams
Move the logic for 'is_executable()' from help.c to exec_cmd.c and expose it so that callers from outside help.c can access the function. This is to enable run-command to be able to query if a file is executable in a future patch. Signed-off-by: Brandon Williams <bmw...@google.

Re: [PATCH v7 1/2] exec_cmd: expose is_executable function

2017-04-25 Thread Brandon Williams
On 04/25, Johannes Sixt wrote: > Am 25.04.2017 um 19:54 schrieb Brandon Williams: > >Move the logic for 'is_executable()' from help.c to exec_cmd.c and > >expose it so that callers from outside help.c can access the function. > > The function is quite low-level. IMO, r

Re: [PATCH 0/2] perf: show that wildmatch() regressed for pathological cases in v2.0

2017-04-24 Thread Brandon Williams
some future upload-pack protocol. > > There are probably some web-based programs built on top of git that > are vulnerable to DoS attacks as a result of this, e.g. if they take > user-supplied globs and feed them to ls-files. I was taking a look at wildmatch a few months ago and have an unfinished patch to do some cleanup there. I noticed this was inefficient but didn't expect those kinds of numbers. I wonder how difficult it would be to rewrite it so that we don't have this issue. -- Brandon Williams

Re: [PATCH v7 2/2] run-command: don't try to execute directories

2017-04-25 Thread Brandon Williams
On 04/25, Jonathan Nieder wrote: > Brandon Williams wrote: > > > Subject: run-command: don't try to execute directories > > nit: this is also about non-executable files, now. That would mean > something like > > run-command: don't try to execute director

[PATCH 1/6] submodule: rename add_sha1_to_array

2017-04-28 Thread Brandon Williams
Rename 'add_sha1_to_array()' to 'append_oid_to_array()' to more accuratly describe what the function does since it handles 'struct object_id' and not sha1 character arrays. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 9 + 1 file changed, 5 insertions

[PATCH 6/6] submodule: refactor logic to determine changed submodules

2017-04-28 Thread Brandon Williams
. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 247 ++-- 1 file changed, 105 insertions(+), 142 deletions(-) diff --git a/submodule.c b/submodule.c index 100d31d39..88093779e 100644 --- a/submodule.c +++ b/submo

[PATCH 3/6] submodule: remove add_oid_to_argv

2017-04-28 Thread Brandon Williams
The function 'add_oid_to_argv()' provides the same functionality as 'append_oid_to_argv()'. Remove this duplicate function and instead use 'append_oid_to_argv()' where 'add_oid_to_argv()' was previously used. Signed-off-by: Brandon Williams <bmw...@google.com> --- submodule.c | 10 ++-

[PATCH 5/6] submodule: improve submodule_has_commits

2017-04-28 Thread Brandon Williams
Teach 'submodule_has_commits()' to ensure that if a commit exists in a submodule, that it is also reachable from a ref. This is a prepritory step prior to merging the logic which checkes for changed submodules when fetching or pushing. Signed-off-by: Brandon Williams <bmw...@google.

<    5   6   7   8   9   10   11   12   13   14   >