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

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

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

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 6:27 AM, Brandon Williams wrote: >> On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: >> > @@ -362,8 +368,6 @@ static unsigned prefix_pathspec(struct pathspec_item >> > *item, >> > } else { >> > item->original = xstrdup(elt); >> > } >>

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

2016-12-08 Thread Duy Nguyen
On Tue, Dec 6, 2016 at 3:16 AM, Brandon Williams wrote: > On 12/05, Stefan Beller wrote: >> > static const char *real_path_internal(const char *path, int die_on_error) >> > { >> > - static struct strbuf sb = STRBUF_INIT; >> > + static struct strbuf resolved = STRBUF_INIT; >> >> Also

Re: [PATCHv6 1/7] submodule: use absolute path for computing relative path connecting

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: > The current caller of connect_work_tree_and_git_dir passes > an absolute path for the `git_dir` parameter. In the future patch > we will also pass in relative path for `git_dir`. Extend the functionality > of connect_work_tree_and_git_dir to t

Re: [PATCHv6 2/7] submodule helper: support super prefix

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: > Just like main commands in Git, the submodule helper needs > access to the superproject prefix. Enable this in the git.c > but have its own fuse in the helper code by having a flag to > turn on the super prefix. > > Signed-off-by: Stefan Belle

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

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: > > worktree = xcalloc(1, sizeof(*worktree)); > worktree->path = strbuf_detach(&worktree_path, NULL); > @@ -101,7 +101,8 @@ static struct worktree *get_main_worktree(void) All the good stuff is outside context lines again.. Some

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-08 Thread Paul Tan
Hi Junio, On Thu, Dec 8, 2016 at 4:48 AM, Stefan Beller wrote: > On Wed, Dec 7, 2016 at 11:41 AM, Junio C Hamano wrote: >> The require_clean_work_tree() function calls hold_locked_index() >> with die_on_error=0 to signal that it is OK if it fails to obtain >> the lock, but unconditionally calls

Re: [PATCH 1/5] am: Fix filename in safe_to_abort() error message

2016-12-08 Thread Paul Tan
Hi Stephan, On Thu, Dec 8, 2016 at 5:51 AM, Stephan Beyer wrote: > diff --git a/builtin/am.c b/builtin/am.c > index 6981f42ce..7cf40e6f2 100644 > --- a/builtin/am.c > +++ b/builtin/am.c > @@ -2124,7 +2124,7 @@ static int safe_to_abort(const struct am_state *state) > > if (read_state_file(

Re: [PATCHv6 5/7] worktree: add function to check if worktrees are in use

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: > Signed-off-by: Stefan Beller > --- > worktree.c | 24 > worktree.h | 7 +++ > 2 files changed, 31 insertions(+) > > diff --git a/worktree.c b/worktree.c > index 75db689672..2559f33846 100644 > --- a/worktree.c >

Re: [PATCHv6 5/7] worktree: add function to check if worktrees are in use

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 5:40 PM, Duy Nguyen wrote: > Alternatively, we could add a new flag to get_worktrees() to tell it > to return all worktrees if there is a least one linked worktree, or > return NULL if there's only main worktree. I'm not sure if this is > clever or very stupid. No, this may

Re: [PATCHv6 7/7] submodule: add absorb-git-dir function

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: > diff --git a/dir.c b/dir.c > index 8b74997c66..cc5729f733 100644 > --- a/dir.c > +++ b/dir.c > @@ -2774,3 +2774,15 @@ void connect_work_tree_and_git_dir(const char > *work_tree, const char *git_dir) > free(real_work_tree); > f

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

2016-12-08 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 4:01 AM, Stefan Beller wrote: > +/* > + * Migrate the git directory of the given `path` from `old_git_dir` to > + * `new_git_dir`. If an error occurs, append it to `err` and return the > + * error code. > + */ > +int relocate_gitdir(const char *path, const char *old_git_dir,

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

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

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

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

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

2016-12-08 Thread Johannes Sixt
Am 07.12.2016 um 23:29 schrieb Brandon Williams: Instead of assuming root is "/" I'll need to extract what root is from an absolute path. Aside from what root looks like, do most other path constructs behave similarly in unix and windows? (like ".." and "." as examples) Yes, .. and . work the

Serious bug with Git-2.11.0-64-bit and Git-LFS

2016-12-08 Thread Nick Warr
Using Git-2.11.0 with the latest git-lfs 1.5.2 (also tested with 1.5.3) cloning from our locally hosted gitlab CE server via HTTPS. When cloning a repo (large, 3.3 gig in git, 10.3 in LFS) for the first time the clone will finish the checkout of the git part, then when it starts downloading the

Re: [PATCH 3/3] lockfile: LOCK_REPORT_ON_ERROR

2016-12-08 Thread Johannes Schindelin
Hi Junio, On Wed, 7 Dec 2016, Junio C Hamano wrote: > The "libify sequencer" topic stopped passing the die_on_error option > to hold_locked_index(), and this lost an error message from "git > merge --ff-only $commit" when there are competing updates in > progress. Sorry for the breakage. When l

Re:Christmas Is Here!

2016-12-08 Thread Jully
Hi, My name is Julinda, i'm single and looking.

[PATCH v2] commit: make --only --allow-empty work without paths

2016-12-08 Thread Andreas Krey
--only is implied when paths are present, and required them unless --amend. But with --allow-empty it should be allowed as well - it is the only way to create an empty commit in the presence of staged changes. Also remove the post-fact cleverness indication; it's in the man page anyway. Signed-of

Re: Serious bug with Git-2.11.0-64-bit and Git-LFS

2016-12-08 Thread Lars Schneider
> On 08 Dec 2016, at 12:46, Nick Warr wrote: > > Using Git-2.11.0 with the latest git-lfs 1.5.2 (also tested with > 1.5.3) cloning from our locally hosted gitlab CE server via HTTPS. > > When cloning a repo (large, 3.3 gig in git, 10.3 in LFS) for the > first time the clone will finish the che

Re: Serious bug with Git-2.11.0-64-bit and Git-LFS

2016-12-08 Thread Nick Warr
That looks pretty much like the error we're dealing with, any reason why going back a point version on Git (not git-lfs) would resolve the issue however? On 8 December 2016 at 13:57, Lars Schneider wrote: > >> On 08 Dec 2016, at 12:46, Nick Warr wrote: >> >> Using Git-2.11.0 with the latest git-

[PATCHv2 3/7] t7004-tag: add version sort tests to show prerelease reordering issues

2016-12-08 Thread SZEDER Gábor
Version sort with prerelease reordering sometimes puts tagnames in the wrong order, when the common part of two compared tagnames ends with the leading character(s) of one or more configured prerelease suffixes. Add tests that demonstrate these issues. The unrelated '--format should list tags as

[PATCHv2 1/7] t7004-tag: delete unnecessary tags with test_when_finished

2016-12-08 Thread SZEDER Gábor
The '--force is moot with a non-existing tag name' test creates two new tags, which are then deleted right after the test is finished, outside the test_expect_success block, allowing 'git tag -d's output to pollute the test output. Use test_when_finished to delete those tags. Signed-off-by: SZEDE

[PATCHv2 0/7] Fix and generalize version sort reordering

2016-12-08 Thread SZEDER Gábor
> After having slept on this a couple of times After having slept on it a few (erm...) more times... > I think the longest > matching prerelease suffix should determine the sorting order. > > A release tag usually consists of an optional prefix, e.g. 'v' or > 'snapshot-', followed by the actual

[PATCHv2 2/7] t7004-tag: use test_config helper

2016-12-08 Thread SZEDER Gábor
... instead of setting and then manually unsetting configuration variables, on one occasion even outside the test_expect_success block. Signed-off-by: SZEDER Gábor --- t/t7004-tag.sh | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/t/t7004-tag.sh b/t/

[PATCHv2 7/7] versioncmp: generalize version sort suffix reordering

2016-12-08 Thread SZEDER Gábor
The 'versionsort.prereleaseSuffix' configuration variable, as its name suggests, is supposed to only deal with tagnames with prerelease suffixes, and allows sorting those prerelease tags in a user-defined order before the suffixless main release tag, instead of sorting them simply lexicographically

[PATCHv2 5/7] versioncmp: cope with common part overlapping with prerelease suffix

2016-12-08 Thread SZEDER Gábor
Version sort with prerelease reordering sometimes puts tagnames in the wrong order, when the common part of two compared tagnames overlaps with the leading character(s) of one or more configured prerelease suffixes. Note the position of "v2.1.0-beta-1": $ git -c versionsort.prereleaseSuffix=-be

[PATCHv2 4/7] versioncmp: pass full tagnames to swap_prereleases()

2016-12-08 Thread SZEDER Gábor
The swap_prereleases() helper function is responsible for finding configured prerelease suffixes in a pair of tagnames to be compared, but this function currently gets to see only the parts of those two tagnames starting at the first different character. To fix some issues related to the common pa

[PATCHv2 6/7] versioncmp: use earliest-longest contained suffix to determine sorting order

2016-12-08 Thread SZEDER Gábor
When comparing tagnames, it is possible that a tagname contains more than one of the configured prerelease suffixes around the first different character. After fixing a bug in the previous commit such a tagname is sorted according to the contained suffix which comes first in the configuration. Th

Re: Serious bug with Git-2.11.0-64-bit and Git-LFS

2016-12-08 Thread Lars Schneider
> On 08 Dec 2016, at 15:00, Nick Warr wrote: > > That looks pretty much like the error we're dealing with, any reason > why going back a point version on Git (not git-lfs) would resolve the > issue however? Going back to GitLFS 1.4.* would make the error disappear. However, I think you should f

[REGRESSION 2.10.2] problematic "empty auth" changes

2016-12-08 Thread Johannes Schindelin
Hi Dave, I got a couple of bug reports that claim that 2.10.2 regressed on using network credentials. That is, users regularly hit Enter twice when being asked for user name and password while fetching via https://, and cURL automatically used to fall back to using the login credentials (i.e. auth

[PATCHv2 6.5/7] squash! versioncmp: use earliest-longest contained suffix to determine sorting order

2016-12-08 Thread SZEDER Gábor
As the number of identical steps to be done for both tagnames grows, extract them into a helper function, with the additional benefit that the conditionals near the end of swap_prereleases() will use more meaningful variable names. Signed-off-by: SZEDER Gábor --- I was not particularly happy wit

Re: [PATCH 4/5] Make sequencer abort safer

2016-12-08 Thread Johannes Schindelin
Hi, On Wed, 7 Dec 2016, Stephan Beyer wrote: > diff --git a/sequencer.c b/sequencer.c > index 30b10ba14..c9b560ac1 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -27,6 +27,7 @@ GIT_PATH_FUNC(git_path_seq_dir, "sequencer") > static GIT_PATH_FUNC(git_path_todo_file, "sequencer/todo") > stati

[PATCH/RFC 1/7] Make read_early_config() reusable

2016-12-08 Thread Johannes Schindelin
The pager configuration needs to be read early, possibly before discovering any .git/ directory. Let's not hide this function in pager.c, but make it available to other callers. Signed-off-by: Johannes Schindelin --- cache.h | 1 + config.c | 31 +++ pager.c | 31

[PATCH/RFC 5/7] read_early_config(): really discover .git/

2016-12-08 Thread Johannes Schindelin
Earlier, we punted and simply assumed that we are in the top-level directory of the project, and that there is no .git file but a .git/ directory so that we can read directly from .git/config. Let's discover the .git/ directory correctly. Signed-off-by: Johannes Schindelin --- config.c | 69 +++

[PATCH/RFC 3/7] Mark builtins that create .git/ directories

2016-12-08 Thread Johannes Schindelin
To refactor read_early_config() so that it discovers .git/config properly, we have to make certain that commands such as `git init` (i.e. commands that create their own .git/ and therefore do *not* want to be affected by any other .git/ directory) skip this discovery. Let's introduce a flag that s

[PATCH/RFC 4/7] read_early_config(): special-case `init` and `clone`

2016-12-08 Thread Johannes Schindelin
The `init` and `clone` commands create their own .git/ directory, therefore we must be careful not to read any repository config when determining the pager settings. Signed-off-by: Johannes Schindelin --- builtin/am.c| 2 +- builtin/blame.c | 2 +- builtin/grep.c | 4 ++-- builtin/log.c

[PATCH/RFC 2/7] read_early_config(): avoid .git/config hack when unneeded

2016-12-08 Thread Johannes Schindelin
So far, we only look whether the startup_info claims to have seen a git_dir. However, do_git_config_sequence() (and consequently the git_config_with_options() call used by read_early_config() asks the have_git_dir() function whether we have a .git/ directory, which in turn also looks at git_dir an

[PATCH/RFC 0/7] Pie-in-the-sky attempt to fix the early config

2016-12-08 Thread Johannes Schindelin
Hopefully these patches will lead to something that we can integrate, and that eventually will make Git's startup sequence much less surprising. The idea here is to discover the .git/ directory gently (i.e. without changing the current working directory), and to use it to read the .git/config file

[PATCH/RFC 6/7] WIP read_config_early(): respect ceiling directories

2016-12-08 Thread Johannes Schindelin
This ports the part from setup_git_directory_gently_1() where the GIT_CEILING_DIRECTORIES environment variable is handled. TODO: DRY up code again (exporting canonicalize_ceiling_directories()?) Signed-off-by: Johannes Schindelin --- config.c | 56 +++

[PATCH/RFC 7/7] WIP: read_early_config(): add tests

2016-12-08 Thread Johannes Schindelin
Signed-off-by: Johannes Schindelin --- t/helper/test-config.c | 15 +++ t/t1309-early-config.sh | 50 + 2 files changed, 65 insertions(+) create mode 100755 t/t1309-early-config.sh diff --git a/t/helper/test-config.c b/t/helper/test-c

Re: Serious bug with Git-2.11.0-64-bit and Git-LFS

2016-12-08 Thread Nick Warr
On 8 December 2016 at 14:18, Lars Schneider wrote: > >> On 08 Dec 2016, at 15:00, Nick Warr wrote: >> >> That looks pretty much like the error we're dealing with, any reason >> why going back a point version on Git (not git-lfs) would resolve the >> issue however? > > Going back to GitLFS 1.4.* w

Re: [PATCH v2] commit: make --only --allow-empty work without paths

2016-12-08 Thread Junio C Hamano
Andreas Krey writes: > Ok, I've removed the clever message, as Junio suggested. > I don't know what else to do to make it acceptable. :-) > We're going to deploy it internally anyway, but I think > it belongs in git.git as well (aka 'Can I has "will queue"?'). Oh, sorry for being unclear. Befor

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

2016-12-08 Thread Junio C Hamano
Johannes Sixt writes: > Am 07.12.2016 um 23:29 schrieb Brandon Williams: >> Instead of assuming root is "/" >> I'll need to extract what root is from an absolute path. Aside from >> what root looks like, do most other path constructs behave similarly in >> unix and windows? (like ".." and "." as

Re: [PATCH/RFC 0/7] Pie-in-the-sky attempt to fix the early config

2016-12-08 Thread Jeff King
On Thu, Dec 08, 2016 at 04:35:56PM +0100, Johannes Schindelin wrote: > The idea here is to discover the .git/ directory gently (i.e. without > changing the current working directory), and to use it to read the > .git/config file early, before we actually called setup_git_directory() > (if we ever

Re: [PATCH 4/5] Make sequencer abort safer

2016-12-08 Thread Junio C Hamano
Johannes Schindelin writes: > On Wed, 7 Dec 2016, Stephan Beyer wrote: > >> diff --git a/sequencer.c b/sequencer.c >> index 30b10ba14..c9b560ac1 100644 >> --- a/sequencer.c >> +++ b/sequencer.c >> @@ -27,6 +27,7 @@ GIT_PATH_FUNC(git_path_seq_dir, "sequencer") >> static GIT_PATH_FUNC(git_path_tod

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

2016-12-08 Thread Jeff King
On Wed, Dec 07, 2016 at 05:22:30PM -0800, Stefan Beller wrote: > On Wed, Dec 7, 2016 at 4:39 PM, wrote: > > > > > Previously test contained errorneous > > test_must_fail, which was masked by > > missing &&. > > I wonder if we could make either > the test_must_fail intelligent to de

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

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

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-08 Thread Junio C Hamano
Paul Tan writes: > Hmm, to add on, looking at the three other call sites of this > function, two of them (builtin/commit.c and builtin/describe.c) > basically do: > > if (0 <= fd) > update_index_if_able(...) > > with that 0 <= fd conditional. With this patch it becomes three out of >

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

2016-12-08 Thread Stefan Beller
On Thu, Dec 8, 2016 at 9:46 AM, Jeff King wrote: > > will both trigger on the &&-chain linter, because it uses a magic exit > code to detect the breakage. I think the problem is just that the > &&-chain linter cannot peek inside subshells, and that's where the bug > was in this case. Uh, yeah in

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

2016-12-08 Thread vi0oss
On 12/08/2016 08:46 PM, Jeff King wrote: On Wed, Dec 07, 2016 at 05:22:30PM -0800, Stefan Beller wrote: On Wed, Dec 7, 2016 at 4:39 PM, wrote: Previously test contained errorneous test_must_fail, which was masked by missing &&. I wonder if we could make either the test_must_

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

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

Re: [PATCH 3/3] lockfile: LOCK_REPORT_ON_ERROR

2016-12-08 Thread Robbie Iannucci
Thanks all for taking a look at this, I didn't expect such a quick response :). No hard feelings re: breakage; I know how gnarly these sorts of refactors can be (and more libification is always better :)). Robbie On Thu, Dec 8, 2016 at 3:53 AM, Johannes Schindelin wrote: > Hi Junio, > > On Wed,

Re: [PATCH 3/3] lockfile: LOCK_REPORT_ON_ERROR

2016-12-08 Thread Junio C Hamano
Johannes Schindelin writes: > Sorry for the breakage. Apologies from me, too. Once a topic is merged, the credit still remains with the contributor, but the blame is shared by the project as a whole, with those who missed breakages during their reviews, and those who didn't review or test and l

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

2016-12-08 Thread Stefan Beller
On Thu, Dec 8, 2016 at 10:04 AM, vi0oss wrote: > On 12/08/2016 08:46 PM, Jeff King wrote: >> >> On Wed, Dec 07, 2016 at 05:22:30PM -0800, Stefan Beller wrote: >> >>> On Wed, Dec 7, 2016 at 4:39 PM, wrote: >>> Previously test contained errorneous test_must_fail, which was mask

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

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

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

2016-12-08 Thread Johannes Sixt
Am 08.12.2016 um 08:55 schrieb Torsten Bögershausen: Some conversion may be done in mingw.c: https://github.com/github/git-msysgit/blob/master/compat/mingw.c So what I understand, '/' in Git are already converted into '\' if needed ? Only if needed, and there are not many places where this is t

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

2016-12-08 Thread Jeff King
On Thu, Dec 08, 2016 at 09:04:46PM +0300, vi0oss wrote: > Why Git test use &&-chains instead of proper "set -e"? Because "set -e" comes with all kinds of confusing corner cases. Using && chains is annoying, but rarely surprising. One of my favorite examples is: set -e ( false echo 1

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

2016-12-08 Thread Stefan Beller
On Thu, Dec 8, 2016 at 2:09 AM, Duy Nguyen wrote: > On Thu, Dec 8, 2016 at 8:46 AM, Stefan Beller wrote: >> >> worktree = xcalloc(1, sizeof(*worktree)); >> worktree->path = strbuf_detach(&worktree_path, NULL); >> @@ -101,7 +101,8 @@ static struct worktree *get_main_worktree(void)

Re: [PATCH v8 00/19] port branch.c to use ref-filter's printing options

2016-12-08 Thread Junio C Hamano
Jacob Keller writes: >> + are left behind. If a displayed ref has fewer components than >> + ``, the command aborts with an error. >> > > Would it make more sense to not die and instead just return the empty > string? On the one hand, if we die() it's obvious that you tried to > stri

Re: [PATCH 2/2] ref-filter: add function to parse atoms from a nul-terminated string

2016-12-08 Thread SZEDER Gábor
On Wed, Dec 7, 2016 at 5:09 PM, SZEDER Gábor wrote: > ref-filter's parse_ref_filter_atom() function parses an atom between > the start and end pointers it gets as arguments. This is fine for two > of its callers, which process '%(atom)' format specifiers and the end > pointer comes directly from

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

2016-12-08 Thread Brandon Williams
Convert the 'internal_copy_pathspec()' function to 'prefix_path()' instead of using the deprecated 'get_pathspec()' interface. Also, rename 'internal_copy_pathspec()' to 'internal_prefix_pathspec()' to be more descriptive of what the funciton is actually doing. In addition to this, fix a memory l

[PATCH v2 00/16] pathspec cleanup

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

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

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

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

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

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

2016-12-08 Thread Brandon Williams
The logic used to prefix an original pathspec element with 'prefix' magic is more general purpose and can be used for more than just short magic. Remove the extra code paths and rename 'prefix_short_magic' to 'prefix_magic' to better indicate that it can be used in more general situations. Also,

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

2016-12-08 Thread Brandon Williams
The 'original' string entry in a pathspec_item is only duplicated some of the time, instead always make a copy of the original and take ownership of the memory. Since both 'match' and 'original' string entries in a pathspec_item are owned by the pathspec struct, they need to be freed when clearing

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2016-12-08 Thread Brandon Williams
For better clarity, always show the mnemonic and name of the unsupported magic being used. This lets users have a more clear understanding of what magic feature isn't supported. And if they supplied a mnemonic, the user will be told what its corresponding name is which will allow them to more eas

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

2016-12-08 Thread Brandon Williams
Now that all callers of the old 'get_pathspec' interface have been migrated to use the new pathspec struct interface it can be removed from the codebase. Since there are no more users of the '_raw' field in the pathspec struct it can also be removed. This patch also removes the old functionality

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

2016-12-08 Thread Brandon Williams
On 12/08, Johannes Sixt wrote: > Am 08.12.2016 um 08:55 schrieb Torsten Bögershausen: > >Some conversion may be done in mingw.c: > >https://github.com/github/git-msysgit/blob/master/compat/mingw.c > >So what I understand, '/' in Git are already converted into '\' if needed ? > > Only if needed, an

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

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

Re: [PATCH 4/5] Make sequencer abort safer

2016-12-08 Thread Stephan Beyer
Hi, I'm a little afraid of feeding Parkinson's law of triviality here, but... ;) On 12/08/2016 06:27 PM, Junio C Hamano wrote: > Johannes Schindelin writes: > >> On Wed, 7 Dec 2016, Stephan Beyer wrote: >> >>> diff --git a/sequencer.c b/sequencer.c >>> index 30b10ba14..c9b560ac1 100644 >>> ---

Re: [PATCHv6 5/7] worktree: add function to check if worktrees are in use

2016-12-08 Thread Stefan Beller
On Thu, Dec 8, 2016 at 2:51 AM, Duy Nguyen wrote: > On Thu, Dec 8, 2016 at 5:40 PM, Duy Nguyen wrote: >> Alternatively, we could add a new flag to get_worktrees() to tell it >> to return all worktrees if there is a least one linked worktree, or >> return NULL if there's only main worktree. I'm no

Re: [PATCHv2 7/7] versioncmp: generalize version sort suffix reordering

2016-12-08 Thread Junio C Hamano
SZEDER Gábor writes: > The 'versionsort.prereleaseSuffix' configuration variable, as its name > suggests, is supposed to only deal with tagnames with prerelease > suffixes, and allows sorting those prerelease tags in a user-defined > order before the suffixless main release tag, instead of sortin

Feature request: read git config from parent directory

2016-12-08 Thread Dominique Dumont
Hello I use the same machine for work and open-source contribution. In both cases, I deal with a lot of repositories. Depending on whether I commit for work or open-source activities, I must use a different mail address. I used to setup work address for each work repo in git local config, but t

Re: [PATCHv6 2/7] submodule helper: support super prefix

2016-12-08 Thread Stefan Beller
> > unsigned int is probably safer for variables that are used as bit-flags. done > If it's meant for users to see, please _() the string. done >> + { "submodule--helper", cmd_submodule__helper, RUN_SETUP | >> SUPPORT_SUPER_PREFIX}, > > The same macro defined twice in two separate .c fil

[PATCHv7 0/6] submodule absorbgitdirs

2016-12-08 Thread Stefan Beller
v7: * do not expose submodule_get_worktrees. The values may be wrong internally, but for our purpose we do not care about the actual values, only the count. Document the wrong values! * more strings are _(marked up) * renamed variables in connect_work_tree_and_git_dir * unsigned instead of int

[PATCHv7 2/6] submodule helper: support super prefix

2016-12-08 Thread Stefan Beller
Just like main commands in Git, the submodule helper needs access to the superproject prefix. Enable this in the git.c but have its own fuse in the helper code by having a flag to turn on the super prefix. Signed-off-by: Stefan Beller --- builtin/submodule--helper.c | 31

[PATCHv7 1/6] submodule: use absolute path for computing relative path connecting

2016-12-08 Thread Stefan Beller
The current caller of connect_work_tree_and_git_dir passes an absolute path for the `git_dir` parameter. In the future patch we will also pass in relative path for `git_dir`. Extend the functionality of connect_work_tree_and_git_dir to take relative paths for parameters. We could work around this

[PATCHv7 4/6] worktree: have a function to check if worktrees are in use

2016-12-08 Thread Stefan Beller
In a later patch we want to move around the the git directory of a submodule. Both submodules as well as worktrees are involved in placing git directories at unusual places, so their functionality may collide. To react appropriately to situations where worktrees in submodules are in use, offer a ne

[PATCHv7 5/6] move connect_work_tree_and_git_dir to dir.h

2016-12-08 Thread Stefan Beller
That function was primarily used by submodule code, but the function itself is not inherently about submodules. In the next patch we'll introduce relocate_git_dir, which can be used by worktrees as well, so find a neutral middle ground in dir.h. Signed-off-by: Stefan Beller --- dir.c | 25

[PATCHv7 6/6] submodule: add absorb-git-dir function

2016-12-08 Thread Stefan Beller
When a submodule has its git dir inside the working dir, the submodule support for checkout that we plan to add in a later patch will fail. Add functionality to migrate the git directory to be absorbed into the superprojects git directory. The newly added code in this patch is structured such tha

[PATCHv7 3/6] test-lib-functions.sh: teach test_commit -C

2016-12-08 Thread Stefan Beller
Specifically when setting up submodule tests, it comes in handy if we can create commits in repositories that are not at the root of the tested trash dir. Add "-C " similar to gits -C parameter that will perform the operation in the given directory. Signed-off-by: Stefan Beller Signed-off-by: Jun

Re: [PATCH v4] diff: handle --no-abbrev in no-index case

2016-12-08 Thread Junio C Hamano
Jack Bates writes: > There are two different places where the --no-abbrev option is parsed, > and two different places where SHA-1s are abbreviated. We normally parse > --no-abbrev with setup_revisions(), but in the no-index case, "git diff" > calls diff_opt_parse() directly, and diff_opt_parse()

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

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

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

2016-12-08 Thread Brandon Williams
The current implementation of real_path uses chdir() in order to resolve symlinks. Unfortunately this isn't thread-safe as chdir() affects a process as a whole and not just an individual thread. Instead perform the symlink resolution by hand so that the calls to chdir() can be removed, making rea

[PATCH v2 0/4] road to reentrant real_path

2016-12-08 Thread Brandon Williams
Thanks for all of the comments on v1 of the series. Hopefully this series addresses the issues with windows and actually passes the first test :) Some changes in v2: * the 1st component of a path should now be handled correctly on windows as well as unix. * Pushed the static strbuf to the calle

Re: [PATCH v8 00/19] port branch.c to use ref-filter's printing options

2016-12-08 Thread Junio C Hamano
Thanks. Will replace, with the attached stylistic fixes squashed in for minor issues that were spotted by my mechanical pre-acceptance filter. ref-filter.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git b/ref-filter.c a/ref-filter.c index a68ed7b147..a9d2c6a89d 10

[PATCH v2 3/4] real_path: create real_pathdup

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

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

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

Re: [PATCH v4] diff: handle --no-abbrev in no-index case

2016-12-08 Thread Jack Bates
On 08/12/16 03:53 PM, Junio C Hamano wrote: Jack Bates writes: @@ -3364,6 +3365,7 @@ void diff_setup(struct diff_options *options) options->file = stdout; + options->abbrev = DEFAULT_ABBREV; This is a new change relative to your earlier one. I looked at all the callers of dif

Re: [PATCH v2 00/16] pathspec cleanup

2016-12-08 Thread Junio C Hamano
Will queue, but with fixes on issues spotted by my pre-acceptance mechanical filter squashed in, to fix style issues in the destination of code movements. pathspec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pathspec.c b/pathspec.c index 08abdd3922..cabc02e79b

  1   2   >