[PATCH] submodule: remove a superfluous second check for the "new" variable

2017-04-17 Thread Sebastian Schuberth
Signed-off-by: Sebastian Schuberth --- submodule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/submodule.c b/submodule.c index c52d663..68623bd 100644 --- a/submodule.c +++ b/submodule.c @@ -1396,8 +1396,7 @@ int submodule_move_head(const char

Re: [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7.

2017-04-17 Thread Johannes Sixt
Am 17.04.2017 um 03:49 schrieb Junio C Hamano: "Something or NULL" is a name we use for a function that returns something (under normal circumstances) or returns NULL. This wrapper is not about returning NULL at all, as far as I can see, and is misnamed. If it is about "avoid moving 0 bytes",

Re: What's cooking in git.git (Apr 2017, #02; Sun, 16)

2017-04-17 Thread René Scharfe
Am 17.04.2017 um 09:30 schrieb Junio C Hamano: > * dt/xgethostname-nul-termination (2017-04-13) 1 commit > - xgethostname: handle long hostnames > > gethostname(2) may not NUL terminate the buffer if hostname does > not fit; unfortunately there is no easy way to see if our buffer > was

Re: [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Duy Nguyen
(To Junio, this series conflicts slightly with nd/conditional-config-include, let me know if you want me to rebase this on top of that) On Sun, Apr 16, 2017 at 10:51 PM, Jeff King wrote: >> + if (opts.git_dir) { >> struct git_config_source repo_config; >> >>

Re: [PATCH] files_for_each_reflog_ent_reverse(): close stream and free strbuf on error

2017-04-17 Thread Michael Haggerty
On 04/16/2017 06:55 PM, René Scharfe wrote: > Exit the loop orderly through the cleanup code, instead of dashing out > with logfp still open and sb leaking. > > Found with Cppcheck. Nice catch. > Signed-off-by: Rene Scharfe > --- > refs/files-backend.c | 20

[PATCH v2 1/3] config: prepare to pass more info in git_config_with_options()

2017-04-17 Thread Nguyễn Thái Ngọc Duy
So far we can only pass one flag, respect_includes, to thie function. We need to pass some more (non-flag even), so let's make it accept a struct instead of an integer. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/config.c | 21 - cache.h | 7

[PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Nguyễn Thái Ngọc Duy
If setup_git_directory() and friends have not been called, get_git_dir() (because of includeIf.gitdir:XXX) would lead to die("BUG: setup_git_env called without repository"); There are two cases when a config file could be read before $GIT_DIR is located. The first one is

[PATCH v2 3/3] config: correct file reading order in read_early_config()

2017-04-17 Thread Nguyễn Thái Ngọc Duy
Config file reading order is important because each file can override values in the previous files and this is expected behavior. Normally we read in this order, all in do_git_config_sequence(): 1. $HOME/.gitconfig 2. $GIT_DIR/config 3. config from command line However in read_early_config() the

Re: [PATCH 07/18] avoid using fixed PATH_MAX buffers for refs

2017-04-17 Thread Junio C Hamano
Jeff King writes: > diff --git a/builtin/replace.c b/builtin/replace.c > index f83e7b8fc..065515bab 100644 > --- a/builtin/replace.c > +++ b/builtin/replace.c > @@ -93,26 +93,31 @@ typedef int (*each_replace_name_fn)(const char *name, > const char *ref, > static int

Re: [PATCH v8 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-17 Thread Michael Haggerty
On 04/06/2017 03:39 AM, Daniel Ferreira wrote: > This is the seventh version of a patch series that implements the GSoC > microproject of converting a recursive call to readdir() to use dir_iterator. > > v1: >

Re: [PATCH] status: show in-progress info for short status

2017-04-17 Thread Junio C Hamano
Michael J Gruber writes: > Ordinary (long) status shows information about bisect, revert, am, > rebase, cherry-pick in progress, and so does git-prompt.sh. status > --short currently shows none of this information. > > Introduce an `--inprogress` argument to git status so that,

What's cooking in git.git (Apr 2017, #02; Sun, 16)

2017-04-17 Thread Junio C Hamano
Here are the topics that have been cooking. Commits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'. The ones marked with '.' do not appear in any of the integration branches, but I am still holding onto them. You can find the changes

Re: [PATCH v8 4/5] dir_iterator: refactor state machine model

2017-04-17 Thread Michael Haggerty
On 04/06/2017 03:39 AM, Daniel Ferreira wrote: > Perform major refactor of dir_iterator_advance(). dir_iterator has > ceased to rely on a convoluted state machine mechanism of two loops and > two state variables (level.initialized and level.dir_state). This serves > to ease comprehension of the

Re: [PATCH 0/3] rebase --signoff

2017-04-17 Thread Junio C Hamano
Giuseppe Bilotta writes: > Allow signing off a whole patchset by rebasing it with the --signoff > option, which is simply passed through to git am. > Documentation/git-rebase.txt | 5 + > builtin/am.c | 39 + >

Draft of Git Rev News edition 26

2017-04-17 Thread Christian Couder
Hi, A draft of a new Git Rev News edition is available here: https://github.com/git/git.github.io/blob/master/rev_news/drafts/edition-26.md Everyone is welcome to contribute in any section either by editing the above page on GitHub and sending a pull request, or by commenting on this GitHub

minor typo in documentation - surplus 'a'

2017-04-17 Thread René Genz
Dear sir or madam, I noticed a minor typo in `man 1 git-commit`. There are two consecutive 'a'. At: https://github.com/git/git/blob/maint/Documentation/git-commit.txt#L97 you can read: ---8<--- --reset-author:: When used with -C/-c/--amend options, or when committing after a a

Re: [PATCH v10 3/3] read-cache: speed up add_index_entry during checkout

2017-04-17 Thread Jeff Hostetler
On 4/15/2017 1:55 PM, René Scharfe wrote: Am 14.04.2017 um 21:12 schrieb g...@jeffhostetler.com: From: Jeff Hostetler Very nice, especially the perf test! But can we unbundle the different optimizations into separate patches with their own performance numbers?

Re: [PATCH 0/3] rebase --signoff

2017-04-17 Thread Giuseppe Bilotta
On Mon, Apr 17, 2017 at 9:12 AM, Junio C Hamano wrote: > Two questions. > > - Is it better to add a brand new test script than adding new tests >to existing scripts that test "git rebase"? Since this is a completely (in some sense) new feature, I felt it was appropriate

Re: [PATCH v2] fetch-pack: show clearer error message upon ERR

2017-04-17 Thread Jonathan Tan
Junio, I noticed that this did not make it into your "What's cooking" e-mail [1] - is there anything more that you would like to see in this patch? Jonathan Nieder has reviewed an earlier version, and seems to be OK with it. He recommended a change in the error message, which I have changed

Re: Index files autocompletion too slow in big repositories (w / suggestion for improvement)

2017-04-17 Thread Johannes Sixt
Am 17.04.2017 um 06:05 schrieb Junio C Hamano: Johannes Sixt writes: This is about command line completion. We go a long way to avoid forking processes there. What is 10x faster on Linux despite of forking a process may not be so on Windows. Doesn't this depend on how many

Re: [PATCH] Make git log work for git CWD outside of work tree

2017-04-17 Thread Duy Nguyen
On Fri, Apr 14, 2017 at 4:29 AM, Jeff King wrote: > On Wed, Apr 12, 2017 at 08:11:22PM +0700, Duy Nguyen wrote: > >> On Wed, Apr 12, 2017 at 8:01 PM, Jeff King wrote: >> > I dunno. Maybe I am missing some subtle case, but it's not clear to me >> > what the user

Re: Feature request: --format=json

2017-04-17 Thread Fred .Flintstone
So I did "git rev-list --all --pretty" and it looks like "git log". Which outputs a human-readable format. However, if I want something more suitable for machine parsing, is there any way to get that output? Example maybe I want another date format like ISO dates, or maybe a serializable format

Re: Feature request: --format=json

2017-04-17 Thread Fred .Flintstone
So I would either have to do: git rev-list --all Then iterate over each line and do git-cat-file commit . Or do: git rev-list --all | git cat-file --batch If I do it in a batch, then it will be tricky to reliably parse since I don't know when the message body ends and when the next commit

How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Urs Thuermann
Sometimes I need to rename and change a file in one commit. One example would be a file foo.h that begins with #ifndef FOO_H #define FOO_H which should be renamed bar.h and have the FOO_H changed to BAR_H. In subversion I would svn mv foo.h bar.h; vi bar.h; svn ci and then a

Re: How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Duy Nguyen
On Mon, Apr 17, 2017 at 6:36 PM, Urs Thuermann wrote: > Sometimes I need to rename and change a file in one commit. One > example would be a file foo.h that begins with > > #ifndef FOO_H > #define FOO_H > > which should be renamed bar.h and have the FOO_H changed

Re: [PATCH 3/3] reset.c: update files when using sparse to avoid data loss.

2017-04-17 Thread Duy Nguyen
On Sun, Apr 16, 2017 at 11:25 AM, Duy Nguyen wrote: >> Because this is a reset --mixed it will never run through unpack_trees and >> The entries are never marked with CE_REMOVE. > > I know. But in my view, it should. All updates from a tree object to > the index should happen

Re: Feature request: --format=json

2017-04-17 Thread Duy Nguyen
On Mon, Apr 17, 2017 at 7:44 PM, Fred .Flintstone wrote: > So I did "git rev-list --all --pretty" and it looks like "git log". > Which outputs a human-readable format. > > However, if I want something more suitable for machine parsing, is > there any way to get that output? >

Re: [PATCH] Documentation/git-checkout: make doc. of checkout clearer

2017-04-17 Thread Philip Oakley
From: "Christoph Michelbach" On Sun, 2017-04-16 at 22:25 +0100, Philip Oakley wrote: From: "Christoph Michelbach" > It's: git checkout [-p|--patch] [] [--] ... The one I quoted is direct from the Synopsis, which does indicate there are

[PATCH v2] xgethostname: handle long hostnames

2017-04-17 Thread David Turner
If the full hostname doesn't fit in the buffer supplied to gethostname, POSIX does not specify whether the buffer will be null-terminated, so to be safe, we should do it ourselves. Introduce new function, xgethostname, which ensures that there is always a \0 at the end of the buffer. Always use

Re: [PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Junio C Hamano
Junio C Hamano writes: >> +if (!have_git_dir() && opts.git_dir) { >> struct git_config_source repo_config; >> >> memset(_config, 0, sizeof(repo_config)); > > But this one I do not quite understand. When have_git_dir() was > false and asked

Re: [PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 07:56:47PM -0700, Junio C Hamano wrote: > Junio C Hamano writes: > > >> + if (!have_git_dir() && opts.git_dir) { > >>struct git_config_source repo_config; > >> > >>memset(_config, 0, sizeof(repo_config)); > > > > But this one

Re: [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 05:07:52PM +0700, Duy Nguyen wrote: > > You can see the second problem with: > > > > # random external > > cat >git-foo <<-\EOF > > #!/bin/sh > > echo foo > > EOF > > chmod +x git-foo > > PATH=$PWD:$PATH > > > > git init > > git config pager.foo 'sed

Re: [PATCH v2] fetch-pack: show clearer error message upon ERR

2017-04-17 Thread Junio C Hamano
Jonathan Tan writes: > Junio, I noticed that this did not make it into your "What's cooking" > e-mail [1] - is there anything more that you would like to see in this > patch? No. Actually "no" is not a honest answer; "I do not know yet" is. It's just that I haven't

Re: [PATCH v2 2/2] ls-files: fix path used when recursing into submodules

2017-04-17 Thread Junio C Hamano
Jacob Keller writes: > From: Jacob Keller > > Don't assume that the current working directory is the root of the > repository. Correctly generate the path for the recursing child > processes by building it from the work_tree() root instead.

Re: [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 09:13:35AM +0700, Duy Nguyen wrote: > > So we call get_git_dir() always when we're not in early config. Even if > > we don't have a git dir! Doesn't this mean that programs operating > > outside of a repo will still hit the BUG? I.e.: > > > > git config --global

Re: [PATCH v9 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > I think this is the closest to a final version we've ever gotten. I > followed all of Michael and Stefan's suggestions on top of v8, and with > Michael's endorsement made dir_iterator_begin() return NULL and set > errno appropriately in case of an

Re: [PATCH v2 3/3] config: correct file reading order in read_early_config()

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 05:10:02PM +0700, Nguyễn Thái Ngọc Duy wrote: > diff --git a/t/helper/test-config.c b/t/helper/test-config.c > index 8e3ed6a76c..696d0a52fd 100644 > --- a/t/helper/test-config.c > +++ b/t/helper/test-config.c > @@ -84,6 +84,10 @@ int cmd_main(int argc, const char **argv) >

Re: [PATCH v9 1/5] dir_iterator: add tests for dir_iterator API

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > +test_expect_success 'setup' ' > + mkdir -p dir && > + mkdir -p dir/a/b/c/ && > + >dir/b && > + >dir/c && > + mkdir -p dir/d/e/d/ && > + >dir/a/b/c/d && > + >dir/a/e && > + >dir/d/e/d/a && > + > + mkdir -p

Re: [PATCH v9 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > Create helpers to dir_iterator_advance(). Make dir_iterator_advance()'s > code more legible and allow some behavior to be reusable. > > Signed-off-by: Daniel Ferreira > --- This is the kind of change we typically call "refactoring"

Re: [PATCH] submodule: remove a superfluous second check for the "new" variable

2017-04-17 Thread Stefan Beller
On Mon, Apr 17, 2017 at 12:59 AM, Sebastian Schuberth wrote: > Signed-off-by: Sebastian Schuberth > --- > submodule.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/submodule.c b/submodule.c > index c52d663..68623bd 100644

Re: [PATCH] submodule: remove a superfluous second check for the "new" variable

2017-04-17 Thread Sebastian Schuberth
On 2017-04-17 20:02, Stefan Beller wrote: >> diff --git a/submodule.c b/submodule.c >> index c52d663..68623bd 100644 >> --- a/submodule.c >> +++ b/submodule.c >> @@ -1396,8 +1396,7 @@ int submodule_move_head(const char *path, >> cp1.no_stdin = 1; >>

Re: Feature request: --format=json

2017-04-17 Thread Sebastian Schuberth
On 2017-04-17 14:44, Fred .Flintstone wrote: However, if I want something more suitable for machine parsing, is there any way to get that output? Instead of machine parsing, why not directly get what you want via libgit2 (or one of its language bindings), or jgit? [1]

Re: What's cooking in git.git (Apr 2017, #02; Sun, 16)

2017-04-17 Thread Jonathan Nieder
René Scharfe wrote: > Am 17.04.2017 um 09:30 schrieb Junio C Hamano: >> * dt/xgethostname-nul-termination (2017-04-13) 1 commit >> - xgethostname: handle long hostnames >> >> gethostname(2) may not NUL terminate the buffer if hostname does >> not fit; unfortunately there is no easy way to

Re: [PATCH v2] xgethostname: handle long hostnames

2017-04-17 Thread Junio C Hamano
Junio C Hamano writes: > David Turner writes: > >> @@ -250,14 +250,14 @@ static const char *lock_repo_for_gc(int force, pid_t* >> ret_pid) >> ... >> if (!force) { >> -static char locking_host[128]; >> +static char

Re: [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options()

2017-04-17 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > So far we can only pass one flag, respect_includes, to thie function. We s/thie/this/ > need to pass some more (non-flag even), so let's make it accept a struct > instead of an integer. > > Signed-off-by: Nguyễn Thái Ngọc Duy

Re: [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options()

2017-04-17 Thread Junio C Hamano
Jeff King writes: > On Mon, Apr 17, 2017 at 07:27:16PM -0700, Junio C Hamano wrote: > >> > @@ -81,7 +82,7 @@ static struct option builtin_config_options[] = { >> >OPT_GROUP(N_("Other")), >> >OPT_BOOL('z', "null", _null, N_("terminate values with NUL byte")), >> >

Re: [PATCH v2] fetch-pack: show clearer error message upon ERR

2017-04-17 Thread Junio C Hamano
Jonathan Tan writes: > Junio, I noticed that this did not make it into your "What's cooking" > e-mail [1] - is there anything more that you would like to see in this > patch? OK, now I've read it and it makes sense. Thanks for working on it.

Re: [PATCH 2/2] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Junio C Hamano
Duy Nguyen writes: > (To Junio, this series conflicts slightly with > nd/conditional-config-include, let me know if you want me to rebase > this on top of that) I think I can manage---having to resolve inter-topic conflict every once in a while is a good sanity check for me

Re: [PATCH v9 1/5] dir_iterator: add tests for dir_iterator API

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > +cat >expect-sorted-output <<-\EOF && > +[d] (a) [a] ./dir/a > +[d] (a/b) [b] ./dir/a/b > +[d] (a/b/c) [c] ./dir/a/b/c > +[d] (d) [d] ./dir/d > +[d] (d/e) [e] ./dir/d/e > +[d] (d/e/d) [d] ./dir/d/e/d > +[f] (a/b/c/d) [d] ./dir/a/b/c/d > +[f] (a/e) [e]

Re: What's cooking in git.git (Apr 2017, #02; Sun, 16)

2017-04-17 Thread Junio C Hamano
René Scharfe writes: > Am 17.04.2017 um 09:30 schrieb Junio C Hamano: >> * dt/xgethostname-nul-termination (2017-04-13) 1 commit >> - xgethostname: handle long hostnames >> >> gethostname(2) may not NUL terminate the buffer if hostname does >> not fit; unfortunately there is

Re: How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Junio C Hamano
Jacob Keller writes: > Unfortunately I don't have a ready link to the message, but there is a > very good post from early on in Git's development where Linus explains > why Git does not store rename and copy information in the history. One of the most important message

Re: [PATCH v9 4/5] dir_iterator: refactor state machine model

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > Perform major refactor of dir_iterator_advance(). dir_iterator has > ceased to rely on a convoluted state machine mechanism of two loops and > two state variables (level.initialized and level.dir_state). This serves > to ease comprehension of the

Re: [PATCH 07/18] avoid using fixed PATH_MAX buffers for refs

2017-04-17 Thread Junio C Hamano
Jeff King writes: > On Sun, Apr 16, 2017 at 11:00:25PM -0700, Junio C Hamano wrote: > >> > diff --git a/builtin/replace.c b/builtin/replace.c >> > index f83e7b8fc..065515bab 100644 >> > --- a/builtin/replace.c >> > +++ b/builtin/replace.c >> > @@ -93,26 +93,31 @@ typedef int

Re: [PATCH v9 4/5] dir_iterator: refactor state machine model

2017-04-17 Thread Junio C Hamano
Daniel Ferreira writes: > ... > Signed-off-by: Daniel Ferreira > Signed-off-by: Michael Haggerty I had an impression that you took Michael's code snippet and wrote this patch, and if that is the case, the flow of the patch is from

Re: [PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up

2017-04-17 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > @@ -1603,10 +1613,12 @@ void read_early_config(config_fn_t cb, void *data) > { > struct config_options opts = {0}; > struct strbuf buf = STRBUF_INIT; > + char *to_free = NULL; > > opts.respect_includes = 1; > -

Re: [PATCH 07/18] avoid using fixed PATH_MAX buffers for refs

2017-04-17 Thread Jeff King
On Sun, Apr 16, 2017 at 11:00:25PM -0700, Junio C Hamano wrote: > > diff --git a/builtin/replace.c b/builtin/replace.c > > index f83e7b8fc..065515bab 100644 > > --- a/builtin/replace.c > > +++ b/builtin/replace.c > > @@ -93,26 +93,31 @@ typedef int (*each_replace_name_fn)(const char *name, > >

Re: [PATCH] repack: respect gc.pid lock

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 11:29:18PM +, David Turner wrote: > We saw this failure in the logs multiple times (with three different > shas, while a gc was running): > April 12, 2017 06:45 -> ERROR -> 'git -c repack.writeBitmaps=true repack -A > -d --pack-kept-objects' in [repo] failed: >

Re: [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options()

2017-04-17 Thread Jeff King
On Mon, Apr 17, 2017 at 07:27:16PM -0700, Junio C Hamano wrote: > > @@ -81,7 +82,7 @@ static struct option builtin_config_options[] = { > > OPT_GROUP(N_("Other")), > > OPT_BOOL('z', "null", _null, N_("terminate values with NUL byte")), > > OPT_BOOL(0, "name-only", _values, N_("show

Re: [PATCH] Documentation/git-checkout: make doc. of checkout clearer

2017-04-17 Thread Philip Oakley
I've added back the list, as it was accidentally dropped. From: "Christoph Michelbach" On Mon, 2017-04-17 at 17:04 +0100, Philip Oakley wrote: From: "Christoph Michelbach" > > On Sun, 2017-04-16 at 22:25 +0100, Philip Oakley wrote: > > > >

Re: Feature request: --format=json

2017-04-17 Thread Junio C Hamano
"Fred .Flintstone" writes: > So I would either have to do: > git rev-list --all > Then iterate over each line and do git-cat-file commit . > > Or do: > git rev-list --all | git cat-file --batch > > If I do it in a batch, then it will be tricky to reliably parse since > I

Re: How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Jacob Keller
On Mon, Apr 17, 2017 at 2:36 PM, Urs Thuermann wrote: > Igor Djordjevic writes: > >> For both cases (renaming and splitting), would using `--find-copies` >> work for you? Perhaps with some low threshold value to start with, if >> the default

[PATCH v11 3/5] read-cache: speed up add_index_entry during checkout

2017-04-17 Thread git
From: Jeff Hostetler Teach add_index_entry_with_check() to see if the path of the new item is greater than the last path in the index array before attempting to search for it. During checkout, merge_working_tree() populates the new index in sorted order, so this change

[PATCH v11 0/5] read-cache: speed up add_index_entry

2017-04-17 Thread git
From: Jeff Hostetler Version 11 splits the changes in read-cache.c into 3 commits so that they can be independently evaluated. And adds subscript guard for istate->cache_nr > 0 which might be necessary if remove_index_entry_at() deletes the only entry in the array. Jeff

[PATCH v11 1/5] read-cache: add strcmp_offset function

2017-04-17 Thread git
From: Jeff Hostetler Add strcmp_offset() function to also return the offset of the first change. Add unit test and helper to verify. Signed-off-by: Jeff Hostetler --- Makefile | 1 + cache.h | 1 +

[PATCH v4 07/10] run-command: eliminate calls to error handling functions in child

2017-04-17 Thread Brandon Williams
All of our standard error handling paths have the potential to call malloc or take stdio locks; so we must avoid them inside the forked child. Instead, the child only writes an 8 byte struct atomically to the parent through the notification pipe to propagate an error. All user-visible error

[PATCH v4 05/10] run-command: prepare child environment before forking

2017-04-17 Thread Brandon Williams
In order to avoid allocation between 'fork()' and 'exec()' prepare the environment to be used in the child process prior to forking. Switch to using 'execve()' so that the construct child environment can used in the exec'd process. Signed-off-by: Brandon Williams ---

[PATCH v4 09/10] run-command: add note about forking and threading

2017-04-17 Thread Brandon Williams
All non-Async-Signal-Safe functions (e.g. malloc and die) were removed between 'fork' and 'exec' in start_command in order to avoid potential deadlocking when forking while multiple threads are running. This deadlocking is possible when a thread (other than the one forking) has acquired a lock

[PATCH v4 03/10] run-command: prepare command before forking

2017-04-17 Thread Brandon Williams
According to [1] we need to only call async-signal-safe operations between fork and exec. Using malloc to build the argv array isn't async-signal-safe. In order to avoid allocation between 'fork()' and 'exec()' prepare the argv array used in the exec call prior to forking the process. [1]

[PATCH v4 02/10] t0061: run_command executes scripts without a #! line

2017-04-17 Thread Brandon Williams
Add a test to 't0061-run-command.sh' to ensure that run_command can continue to execute scripts which don't include a '#!' line. Signed-off-by: Brandon Williams --- t/t0061-run-command.sh | 11 +++ 1 file changed, 11 insertions(+) diff --git a/t/t0061-run-command.sh

[PATCH v4 04/10] run-command: use the async-signal-safe execv instead of execvp

2017-04-17 Thread Brandon Williams
Convert the function used to exec from 'execvp()' to 'execv()' as the (p) variant of exec isn't async-signal-safe and has the potential to call malloc during the path resolution it performs. Instead we simply do the path resolution ourselves during the preparation stage prior to forking. There

[PATCH v4 10/10] run-command: block signals between fork and execve

2017-04-17 Thread Brandon Williams
From: Eric Wong Signal handlers of the parent firing in the forked child may have unintended side effects. Rather than auditing every signal handler we have and will ever have, block signals while forking and restore default signal handlers in the child before execve. Restoring

[PATCH v4 06/10] run-command: don't die in child when duping /dev/null

2017-04-17 Thread Brandon Williams
Signed-off-by: Brandon Williams --- run-command.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/run-command.c b/run-command.c index 2fff60a04..3aa8b7112 100644 --- a/run-command.c +++ b/run-command.c @@ -117,18 +117,6 @@

[PATCH v4 01/10] t5550: use write_script to generate post-update hook

2017-04-17 Thread Brandon Williams
The post-update hooks created in t5550-http-fetch-dumb.sh is missing the "!#/bin/sh" line which can cause issues with portability. Instead create the hook using the 'write_script' function which includes the proper "#!" line. Signed-off-by: Brandon Williams ---

[PATCH v4 08/10] run-command: handle dup2 and close errors in child

2017-04-17 Thread Brandon Williams
Signed-off-by: Brandon Williams --- run-command.c | 58 ++ 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/run-command.c b/run-command.c index e1e8780ca..bd6414283 100644 --- a/run-command.c +++

[PATCH v4 00/10] forking and threading

2017-04-17 Thread Brandon Williams
v4 fixes a few minor compatability issues: * add 'extern' reference for 'environ' * small portability change with the signal handeling * remove trailing ',' in enum * null_fd not opened with O_NONBLOCK Brandon Williams (9): t5550: use write_script to generate post-update hook t0061:

Re: How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Igor Djordjevic
Hi Urs, On 17/04/2017 13:36, Urs Thuermann wrote: > Sometimes I need to rename and change a file in one commit. One > example would be a file foo.h that begins with > > #ifndef FOO_H > #define FOO_H > > which should be renamed bar.h and have the FOO_H changed to BAR_H. > In subversion

Re: [PATCH v2] fetch-pack: show clearer error message upon ERR

2017-04-17 Thread Jonathan Nieder
Jonathan Tan wrote: > Currently, fetch-pack prints a confusing error message ("expected > ACK/NAK") when the server it's communicating with sends a pkt-line > starting with "ERR". Replace it with a less confusing error message. > > Also update the documentation describing the

[PATCH] doc: trivial typo in git-format-patch.txt

2017-04-17 Thread Giuseppe Bilotta
Signed-off-by: Giuseppe Bilotta --- Documentation/git-format-patch.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index f7a069bb92..c890328b02 100644 ---

Re: [PATCH 0/3] rebase --signoff

2017-04-17 Thread Junio C Hamano
Giuseppe Bilotta writes: >> - How does this interact with "git rebase -i" and other modes of >>operation? > > A better question would maybe be how do we want this to interact? If "git rebase -i/-m --signoff" will not do anything (which I suspect is what we have

Re: [PATCH] doc: trivial typo in git-format-patch.txt

2017-04-17 Thread Jacob Keller
On Mon, Apr 17, 2017 at 3:32 PM, Giuseppe Bilotta wrote: > Signed-off-by: Giuseppe Bilotta > --- > Documentation/git-format-patch.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH v2] xgethostname: handle long hostnames

2017-04-17 Thread Junio C Hamano
David Turner writes: > @@ -250,14 +250,14 @@ static const char *lock_repo_for_gc(int force, pid_t* > ret_pid) > ... > if (!force) { > - static char locking_host[128]; > + static char locking_host[HOST_NAME_MAX + 1]; > int

Re: How to keep log history when renaming and changing simultaneously

2017-04-17 Thread Urs Thuermann
Igor Djordjevic writes: > For both cases (renaming and splitting), would using `--find-copies` > work for you? Perhaps with some low threshold value to start with, if > the default one yields no results. > > If interested, adding `--name-status` to the mix will

RE: [PATCH] repack: respect gc.pid lock

2017-04-17 Thread David Turner
> -Original Message- > From: Jeff King [mailto:p...@peff.net] > Sent: Friday, April 14, 2017 3:34 PM > To: David Turner > Cc: git@vger.kernel.org; christian.cou...@gmail.com; mf...@codeaurora.org; > jacob.kel...@gmail.com > Subject: Re: [PATCH] repack: respect

Re: [PATCH] doc: trivial typo in git-format-patch.txt

2017-04-17 Thread Jonathan Nieder
Giuseppe Bilotta wrote: > Signed-off-by: Giuseppe Bilotta > --- > Documentation/git-format-patch.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) It took me a while to see the typo. It's s/of/or/. Good eyes. Reviewed-by: Jonathan Nieder

Re: [PATCH] Documentation/git-checkout: make doc. of checkout clearer

2017-04-17 Thread Junio C Hamano
"Philip Oakley" writes: >>> If we'd created and added a file d just before the checkout, what >>> should >>> have happened to d, and why? >> >> I understand what the command does. It behaves perfectly as I expected >> it to. I did not find this script but wrote it to

[PATCH v9 4/5] dir_iterator: refactor state machine model

2017-04-17 Thread Daniel Ferreira
Perform major refactor of dir_iterator_advance(). dir_iterator has ceased to rely on a convoluted state machine mechanism of two loops and two state variables (level.initialized and level.dir_state). This serves to ease comprehension of the iterator mechanism and ease addition of new features to

[PATCH v9 5/5] remove_subtree(): reimplement using iterators

2017-04-17 Thread Daniel Ferreira
Use dir_iterator to traverse through remove_subtree()'s directory tree, avoiding the need for recursive calls to readdir(). Simplify remove_subtree()'s code. A conversion similar in purpose was previously done at 46d092a ("for_each_reflog(): reimplement using iterators", 2016-05-21).

[PATCH v9 2/5] remove_subtree(): test removing nested directories

2017-04-17 Thread Daniel Ferreira
Test removing a nested directory when an attempt is made to restore the index to a state where it does not exist. A similar test could be found previously in t/t2000-checkout-cache-clash.sh, but it did not check for nested directories, which could allow a faulty implementation of remove_subtree()

[PATCH v9 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-17 Thread Daniel Ferreira
Create helpers to dir_iterator_advance(). Make dir_iterator_advance()'s code more legible and allow some behavior to be reusable. Signed-off-by: Daniel Ferreira --- dir-iterator.c | 65 +- 1 file changed, 42

[PATCH v9 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-17 Thread Daniel Ferreira
This is the ninth version of a patch series that implements the GSoC microproject of converting a recursive call to readdir() to use dir_iterator. v1: https://public-inbox.org/git/CAGZ79kZwT-9mHTiOJ5CEjk2wDFkn6+NcogjX0=vjhsah16a...@mail.gmail.com/T/#t v2:

[PATCH v9 1/5] dir_iterator: add tests for dir_iterator API

2017-04-17 Thread Daniel Ferreira
Create t/helper/test-dir-iterator.c, which prints relevant information about a directory tree iterated over with dir_iterator. Create t/t0065-dir-iterator.sh, which tests that dir_iterator does iterate through a whole directory tree. Signed-off-by: Daniel Ferreira ---

[PATCH v11 2/5] p0006-read-tree-checkout: perf test to time read-tree

2017-04-17 Thread git
From: Jeff Hostetler Created t/perf/repos/many-files.sh to generate large, but artificial repositories. Created t/perf/p0006-read-tree-checkout.sh to measure performance on various read-tree, checkout, and update-index operations. This test can run using either

[PATCH v11 5/5] read-cache: speed up has_dir_name (part 2)

2017-04-17 Thread git
From: Jeff Hostetler Teach has_dir_name() to see if the path of the new item is greater than the last path in the index array before attempting to search for it. has_dir_name() is looking for file/directory collisions in the index and has to consider each sub-directory

[PATCH v11 4/5] read-cache: speed up has_dir_name (part 1)

2017-04-17 Thread git
From: Jeff Hostetler Teach has_dir_name() to see if the path of the new item is greater than the last path in the index array before attempting to search for it. has_dir_name() is looking for file/directory collisions in the index and has to consider each sub-directory

Re: [PATCH] Documentation/git-checkout: make doc. of checkout clearer

2017-04-17 Thread Junio C Hamano
"Philip Oakley" writes: > I'd guess that the misunderstanding is that you maybe thought that the > whole directory would be reset to it's old state and the files b and c > deleted, rather than just the named files present in that old commit > being extracted. If we'd

Re: [PATCH v4 05/10] run-command: prepare child environment before forking

2017-04-17 Thread Eric Wong
+Cc Karsten for comments below... Brandon Williams wrote: > In order to avoid allocation between 'fork()' and 'exec()' prepare the > environment to be used in the child process prior to forking. > > Switch to using 'execve()' so that the construct child environment can > used