Re: [PATCH 1/4] shallow.c: make paint_alloc slightly more robust

2016-12-05 Thread Duy Nguyen
On Sat, Dec 3, 2016 at 12:14 PM, Jeff King wrote: > On Fri, Dec 02, 2016 at 09:31:01PM +0100, Rasmus Villemoes wrote: > >> I have no idea if this is a real issue, but it's not obvious to me that >> paint_alloc cannot be called with info->nr_bits greater than about >> 4M (\approx 8*COMMIT_SLAB_SIZE

Re: [PATCH 4/4] shallow.c: remove useless test

2016-12-05 Thread Duy Nguyen
On Sat, Dec 3, 2016 at 12:24 PM, Jeff King wrote: > On Fri, Dec 02, 2016 at 09:31:04PM +0100, Rasmus Villemoes wrote: > >> It seems to be odd to do x=y if x==y. Maybe there's a bug somewhere near >> this, but as is this is somewhat confusing. > > Yeah, this code is definitely wrong, but I'm not su

Re: [PATCH] clone,fetch: explain the shallow-clone option a little more clearly

2016-12-06 Thread Duy Nguyen
On Tue, Dec 6, 2016 at 1:28 AM, Junio C Hamano wrote: > I however offhand do not think the feature can be used to make the > repository shallower I'm pretty sure it can, though it's a waste because you should be able to shorten your history without talking to a remote server. But that no-remote s

Re: [PATCH v2 0/6] shallow.c improvements

2016-12-06 Thread Duy Nguyen
On Tue, Dec 6, 2016 at 8:42 PM, Jeff King wrote: > The final one _seems_ reasonable after reading your explanation, but I > lack enough context to know whether or not there might be a corner case > that you're missing. I'm inclined to trust your assessment on it. Yeah I basically just wrote down

Re: git add -p with new file

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 8:18 AM, Ariel wrote: > > If you do git add -p new_file it says: > > No changes. > > Which is a rather confusing message. I would expect it to show me the > content of the file in patch form, in the normal way that -p works, let me > edit it, etc. We could improve it a bit,

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > Convert the 'internal_copy_pathspec()' function to use the pathspec > struct interface from using the deprecated 'get_pathspec()' interface. > > In addition to this, fix a memory leak caused by only duplicating some > of the pathspec elemen

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

2016-12-07 Thread Duy Nguyen
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 kill this create_simplify() and let simplify_away() handle struct pathspec directly. There is a bug

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > Convert 'show_recursive()' to use the pathspec struct interface from > using the '_raw' entry in the pathspec struct. Slightly off-topic (sorry, but you made me look at this code! :D), could you update the magic_mask argument of parse_path

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > 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 | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --g

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > @@ -413,10 +411,9 @@ void parse_pathspec(struct pathspec *pathspec, > prefixlen = prefix ? strlen(prefix) : 0; > > for (i = 0; i < n; i++) { > - unsigned short_magic; > entry = argv[i]; > > -

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > @@ -426,8 +423,7 @@ void parse_pathspec(struct pathspec *pathspec, > nr_exclude++; > if (item[i].magic & magic_mask) > unsupported_magic(entry, > -

Re: 1 files changed

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:46 PM, joris wrote: > When committing a change that touches a single file, git reports : > > 1 files changed, 1069 insertions(+), 1063 deletions(-) > > Note the plural for the single file. What version? This should be fixed since v1.7.10, unless some new bug pops up somew

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > A few small changes to improve readability. This is done by grouping related > assignments, adding blank lines, ensuring lines are <80 characters, etc. > > Signed-off-by: Brandon Williams > --- > pathspec.c | 15 ++- > 1 file

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

2016-12-07 Thread Duy Nguyen
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 > own function. > > Signed-off-by: Brandon Williams > --- > pathspec.c | 120 > +++

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

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams wrote: > A few small changes to improve readability. This is done by grouping related > assignments, adding blank lines, ensuring lines are <80 characters, etc. > > Signed-off-by: Brandon Williams > --- > pathspec.c | 15 ++- > 1 file

Re: [PATCH] clone,fetch: explain the shallow-clone option a little more clearly

2016-12-07 Thread Duy Nguyen
On Wed, Dec 7, 2016 at 1:29 AM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On Tue, Dec 6, 2016 at 1:28 AM, Junio C Hamano wrote: >>> I however offhand do not think the feature can be used to make the >>> repository shallower >> >> I'm pretty

Re: BUG: "cherry-pick A..B || git reset --hard OTHER"

2016-12-07 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 3:35 AM, Stephan Beyer wrote: > Hi, > > On 12/07/2016 09:04 PM, Junio C Hamano wrote: >> Stephan Beyer writes: >> >>> [1] By the way: git cherry-pick --quit, git rebase --forget ... >>> different wording for the same thing makes things unintuitive. >> >> It is not too late

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 mag

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

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

Re: BUG: "cherry-pick A..B || git reset --hard OTHER"

2016-12-09 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 3:04 AM, Junio C Hamano wrote: > Stephan Beyer writes: > >> [1] By the way: git cherry-pick --quit, git rebase --forget ... >> different wording for the same thing makes things unintuitive. > > It is not too late to STOP "--forget" from getting added to "rebase" > and give

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

2016-12-09 Thread Duy Nguyen
On Thu, Dec 08, 2016 at 01:03:27PM -0800, Stefan Beller wrote: > +/* > + * NEEDSWORK: The values in the returned worktrees are broken, e.g. > + * the refs or path resolution is influenced by the current repository. > + */ > +static struct worktree **get_submodule_worktrees(const char *path, unsigne

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

2016-12-09 Thread Duy Nguyen
On Fri, Dec 9, 2016 at 7:28 AM, Junio C Hamano wrote: > Brandon Williams writes: > >> +static void strip_submodule_slash_cheap(struct pathspec_item *item) >> +{ >> + int i; >> + >> + if ((item->len >= 1 && item->match[item->len - 1] == '/') && >> + (i = cache_name_pos(item->match,

Re: [PATCH v2 0/4] road to reentrant real_path

2016-12-09 Thread Duy Nguyen
On Fri, Dec 9, 2016 at 6:58 AM, Brandon Williams wrote: > diff --git a/setup.c b/setup.c > index fe572b8..0d9fdd0 100644 > --- a/setup.c > +++ b/setup.c > @@ -254,10 +254,12 @@ int get_common_dir_noenv(struct strbuf *sb, const char > *gitdir) > if (!is_absolute_path(data.buf)) >

Re: Feature request: read git config from parent directory

2016-12-09 Thread Duy Nguyen
On Fri, Dec 9, 2016 at 2:49 AM, Dominique Dumont wrote: > 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 s

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

2016-12-09 Thread Duy Nguyen
On Thu, Dec 8, 2016 at 10:35 PM, Johannes Schindelin wrote: > Hopefully these patches will lead to something that we can integrate, > and that eventually will make Git's startup sequence much less > surprising. What did it surprise you with? Just curious. I can see that I disrespect the ceiling d

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

2016-12-09 Thread Duy Nguyen
On Fri, Dec 9, 2016 at 1:55 AM, Stefan Beller wrote: > 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->pa

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

2016-12-09 Thread Duy Nguyen
On Fri, Dec 9, 2016 at 1:19 AM, Brandon Williams wrote: > 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: >

Re: BUG: "cherry-pick A..B || git reset --hard OTHER"

2016-12-10 Thread Duy Nguyen
On Sat, Dec 10, 2016 at 2:24 AM, Stephan Beyer wrote: > Hi Junio, > > On 12/09/2016 07:07 PM, Junio C Hamano wrote: >> Duy Nguyen writes: >>> Having the same operation with different names only increases git >>> reputation of bad/inconsistent UI. Either forge

Re: [PATCH v2 0/4] road to reentrant real_path

2016-12-10 Thread Duy Nguyen
On Sat, Dec 10, 2016 at 2:42 AM, Brandon Williams wrote: > On 12/09, Duy Nguyen wrote: >> On Fri, Dec 9, 2016 at 6:58 AM, Brandon Williams wrote: >> > diff --git a/setup.c b/setup.c >> > index fe572b8..0d9fdd0 100644 >> > --- a/setup.c >> >

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

2016-12-10 Thread Duy Nguyen
On Sat, Dec 10, 2016 at 1:49 AM, Stefan Beller wrote: > On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen wrote: > >> int submodule_uses_worktrees(const char *path) >> { >> struct strbuf path = STRBUF_INIT; >> DIR *dir; >> stru

Re: [PATCHv2] git-p4: support git worktrees

2016-12-13 Thread Duy Nguyen
On Sun, Dec 11, 2016 at 2:19 PM, Luke Diamand wrote: > On 10 December 2016 at 21:57, Luke Diamand wrote: >> git-p4 would attempt to find the git directory using >> its own specific code, which did not know about git >> worktrees. This caused git operations to fail needlessly. >> >> Rework it to u

Re: [PATCH 1/2] alternates: accept double-quoted paths

2016-12-13 Thread Duy Nguyen
On Tue, Dec 13, 2016 at 2:52 AM, Jeff King wrote: > Instead, let's treat names as unquoted unless they begin > with a double-quote, in which case they are interpreted via > our usual C-stylke quoting rules. This also breaks > backwards-compatibility, but in a smaller way: it only > matters if your

Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message

2016-05-02 Thread Duy Nguyen
On Tue, May 3, 2016 at 11:20 AM, Jeff King wrote: > Note that I do not think the singular case can ever trigger with your > new code. We know that both "ours" and "theirs" are non-zero to get to > this message, which means "ours + theirs" must be at least 2 (barring > negative commit counts, of co

Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message

2016-05-03 Thread Duy Nguyen
On Tue, May 3, 2016 at 11:48 AM, Jeff King wrote: > On Tue, May 03, 2016 at 11:43:41AM +0700, Duy Nguyen wrote: > >> On Tue, May 3, 2016 at 11:20 AM, Jeff King wrote: >> > Note that I do not think the singular case can ever trigger with your >> > new code. We kno

Re: [PATCH 01/41] usage.c: move format processing out of die_errno()

2016-05-03 Thread Duy Nguyen
On Tue, May 3, 2016 at 11:45 AM, Jeff King wrote: > On Mon, May 02, 2016 at 11:26:02AM -0700, Junio C Hamano wrote: > >> Caller supplied buffer would be the way to go when multiple threads >> could be showing errors and warnings, right? >> >> It would not make too much of a difference for die(), t

Re: [PATCH 78/83] Move libified code from builtin/apply.c to apply.{c,h}

2016-05-04 Thread Duy Nguyen
On Wed, May 4, 2016 at 5:39 PM, Christian Couder wrote: > On Mon, Apr 25, 2016 at 3:46 PM, Duy Nguyen wrote: >> On Sun, Apr 24, 2016 at 8:34 PM, Christian Couder >> wrote: >>> Signed-off-by: Christian Couder >>>

Re: /* compiler workaround */ - what was the issue?

2016-05-06 Thread Duy Nguyen
On Fri, May 6, 2016 at 4:41 AM, Junio C Hamano wrote: > "Philip Oakley" writes: > >> int saved_namelen = saved_namelen; /* compiler workaround */ >> >> Which then becomes an MSVC compile warning C4700: uninitialized local >> variable. >> >> I'm wondering what was the compiler workaround being

Re: [PATCH v3 05/13] worktree.c: mark current worktree

2016-05-06 Thread Duy Nguyen
On Fri, May 6, 2016 at 2:51 PM, Eric Sunshine wrote: > On Fri, Apr 22, 2016 at 9:01 AM, Nguyễn Thái Ngọc Duy > wrote: >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- >> diff --git a/worktree.c b/worktree.c >> @@ -147,6 +150,25 @@ done: >> +static void mark_current_worktree(struct worktree **workt

Re: [PATCH] pathspec: remove check_path_for_gitlink

2016-05-06 Thread Duy Nguyen
On Fri, May 6, 2016 at 6:27 AM, Junio C Hamano wrote: > Stefan Beller writes: > >>> I wonder if the patches mentioned have something to do with the "git >>> add deep/in/the/tree" that fails to notice deep/in/ is an unrelated >>> repository in some way? The same functionality is added in 8745024

Re: [PATCH] pathspec: remove check_path_for_gitlink

2016-05-07 Thread Duy Nguyen
On Sat, May 7, 2016 at 2:18 AM, Stefan Beller wrote: > On Fri, May 6, 2016 at 12:02 PM, Junio C Hamano wrote: >> Stefan Beller writes: >> >>> On Fri, May 6, 2016 at 3:30 AM, Duy Nguyen wrote: >>>> On Fri, May 6, 2016 at 6:27 AM, Junio C Hamano

Re: [PATCH] Move test-* to t/helper/ subdirectory

2016-05-08 Thread Duy Nguyen
So among the options we have so far, which way should we go, or leave it as is? On Tue, May 3, 2016 at 7:15 AM, Duy Nguyen wrote: > On Tue, May 3, 2016 at 12:34 AM, Junio C Hamano wrote: >> Duy Nguyen writes: >> >>> I may have rushed to judgement. wrap-for-bi

Re: [PATCH v8 18/19] Add tracing to measure where most of the time is spent

2016-05-08 Thread Duy Nguyen
On Fri, May 6, 2016 at 5:48 AM, Junio C Hamano wrote: > David Turner writes: > >> From: Nguyễn Thái Ngọc Duy >> Subject: Re: [PATCH v8 18/19] Add tracing to measure where most of the time >> is spent > > trace: measure where the time is spent in the index-heavy operations Right. All these inv

Re: [PATCH 80/83] run-command: make dup_devnull() non static

2016-05-08 Thread Duy Nguyen
On Sun, May 8, 2016 at 1:33 PM, Johannes Schindelin wrote: > The claim is that this libifies the procedure. But it makes the code > really nasty for use as a library: if this is run in a thread (and you > know that we are going to have to do this in the near future, for > performance reasons), it

Re: [PATCH v9 03/19] index-helper: new daemon for caching index and related stuff

2016-05-10 Thread Duy Nguyen
This reminds me, we need to update command-list.txt as well. I guess it belongs to purehelpers? Back to the patch.. On Tue, May 10, 2016 at 5:13 PM, SZEDER Gábor wrote: > This patch adds a new plumbing command, which then will show up in > completion after 'git '. Could you please squash in this

Re: [PATCH v9 03/19] index-helper: new daemon for caching index and related stuff

2016-05-10 Thread Duy Nguyen
On Tue, May 10, 2016 at 6:12 PM, SZEDER Gábor wrote: > > Quoting Duy Nguyen : > >> This reminds me, we need to update command-list.txt as well. I guess >> it belongs to purehelpers? Back to the patch.. >> >> On Tue, May 10, 2016 at 5:13 PM, SZEDER Gábor wro

Re: [PATCH] Move test-* to t/helper/ subdirectory

2016-05-10 Thread Duy Nguyen
On Mon, May 09, 2016 at 09:03:44AM -0700, Junio C Hamano wrote: > Duy Nguyen writes: > > > So among the options we have so far, which way should we go, or leave it as > > is? > > Thanks for reminding me. > > I like that version you sent with "I may have rus

Re: [PATCH v9 00/19] index-helper/watchman

2016-05-10 Thread Duy Nguyen
On Tue, May 10, 2016 at 6:12 AM, David Turner wrote: > I think that's a SIGPIPE on the first git status. Weird, since I just > added sigpipe-avoidance code (in v8). Does anyone have any idea why > the sigchain stuff isn't doing what I think it is? SIGPIPE code works. I tested with and without -

Re: [PATCH v9 00/19] index-helper/watchman

2016-05-10 Thread Duy Nguyen
On Tue, May 10, 2016 at 7:45 PM, Duy Nguyen wrote: > If --detach is used, log_warning() can't cover die(), > warning() or error(), most importantly die() for example because of > bugs. A case for redirecting warning() is because watchman-support.c uses it. But because this file i

Re: [PATCH v3 05/13] worktree.c: mark current worktree

2016-05-10 Thread Duy Nguyen
On Fri, May 06, 2016 at 05:21:05PM +0700, Duy Nguyen wrote: > > Similarly, it looks like 'path' doesn't need to be a strbuf at all > > since the result of absolute_path() should remain valid long enough > > for fspathcmp(). It could just be: > > &

Re: [PATCH v3 05/13] worktree.c: mark current worktree

2016-05-10 Thread Duy Nguyen
On Wed, May 11, 2016 at 6:03 AM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On second thought, why hold patches back, lengthen the worktree-move >> series and make it a pain to review? I moved a few patches from >> worktree-move into this series and I took two o

Re: [PATCH 7/7] worktree: simplify prefixing paths

2016-05-10 Thread Duy Nguyen
On Wed, May 11, 2016 at 6:07 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- > > This changes semantics, doesn't it? prefix_filename() seems to do a > lot more than just strbuf_vadd("%s%s", prefix, filename); would do. > > It may be a go

Re: [PATCH 24/25] worktree move: accept destination as directory

2016-05-11 Thread Duy Nguyen
On Wed, May 11, 2016 at 11:43 AM, Eric Sunshine wrote: > On Wed, Apr 13, 2016 at 9:15 AM, Nguyễn Thái Ngọc Duy > wrote: >> Similar to "mv a b/", which is actually "mv a b/a", we extract basename >> of source worktree and create a directory of the same name at >> destination if dst path is a dire

Re: [PATCH v10 20/20] untracked-cache: config option

2016-05-15 Thread Duy Nguyen
On Fri, May 13, 2016 at 3:20 AM, David Turner wrote: > Add a config option to populate the untracked cache. > > For installations that have centrally-managed configuration, it's > easier to set a config once than to run update-index on every > repository. This sounds like the job for core.untrack

Re: [RFC PATCH 0/4] pathspec labels [WAS: submodule groups]

2016-05-15 Thread Duy Nguyen
On Fri, May 13, 2016 at 7:19 AM, Stefan Beller wrote: > After some fruitful discussion[1] in which Junio suggested trying a very > different route[2] that is more general and not submodule related, I > considered > doing a mock for this. > > This lets you label arbitrary pathspecs, e.g. in git.gi

Re: [RFC PATCH 0/4] pathspec labels [WAS: submodule groups]

2016-05-15 Thread Duy Nguyen
On Mon, May 16, 2016 at 2:33 AM, Junio C Hamano wrote: > Junio C Hamano writes: > >> Duy Nguyen writes: >> >>> Instead of putting everything in under the same attribute name >>> "label", make one attribute per label? Would this work? >>

Re: [PATCH 5/7] worktree.c: add clear_worktree()

2016-05-22 Thread Duy Nguyen
On Wed, May 11, 2016 at 1:36 PM, Eric Sunshine wrote: > On Tue, May 10, 2016 at 10:15 AM, Nguyễn Thái Ngọc Duy > wrote: >> The use case is keep some worktree and discard the rest of the worktree >> list. > > So, you're saying that rather than a client freeing the entire > worktree list like this:

Re: [PATCH 3/5] worktree.c: add is_worktree_locked()

2016-05-22 Thread Duy Nguyen
On Fri, May 13, 2016 at 11:52 PM, Eric Sunshine wrote: > Actually, I recall that when I suggested the idea of 'struct worktree' > and get_worktrees() to Mike that it would be natural for the structure > to have a 'locked' (or 'locked_reason') field, in which case the > reason could be stored there

Re: [PATCH 4/5] worktree: add "lock" command

2016-05-22 Thread Duy Nguyen
(the answer to rest of your questions is "yes you're right, will fix" or something along that line so I will not quote them here) On Mon, May 16, 2016 at 7:09 AM, Eric Sunshine wrote: >> + old_reason = is_worktree_locked(wt); >> + if (old_reason) { >> + if (*old_reason)

Re: [PATCHv8 0/5] pathspec magic extension to search for attributes

2016-05-22 Thread Duy Nguyen
On Fri, May 20, 2016 at 4:25 AM, Stefan Beller wrote: >> My take is to pretend sparse checkout does not exist at all and then >> go from there ;-) Hehe.. shameless plug, narrow checkout [1] should be its great successor where everything is done right (famous last words). Maybe I can convince Stef

Re: [PATCH 1/2] fetch: better alignment in ref summary

2016-05-22 Thread Duy Nguyen
On Mon, May 23, 2016 at 7:58 AM, Junio C Hamano wrote: > That is, I wonder if the above can become something like: > >> From github.com:pclouds/git >> * [new branch] { -> pclouds/}2nd-index >> * [new branch] { -> pclouds/}3nd-index >> * [new branch] { -> pclouds/}file-watcher >>

Re: [PATCH v2 0/5] worktree lock/unlock

2016-05-23 Thread Duy Nguyen
On Mon, May 23, 2016 at 11:51 AM, Eric Sunshine wrote: > On Sun, May 22, 2016 at 6:43 AM, Nguyễn Thái Ngọc Duy > wrote: >> This should address all of Eric's comments (thanks!). An extra change >> I made is free_worktrees() at the end of {,un}lock_worktree() to avoid >> leaking. This series depen

Re: [PATCH v2 6/6] worktree: simplify prefixing paths

2016-05-23 Thread Duy Nguyen
On Mon, May 23, 2016 at 11:31 AM, Eric Sunshine wrote: > On Sun, May 22, 2016 at 7:32 PM, Eric Sunshine > wrote: >> On Sun, May 22, 2016 at 5:33 AM, Nguyễn Thái Ngọc Duy >> wrote: >>> @@ -467,6 +467,8 @@ int cmd_worktree(int ac, const char **av, const char >>> *prefix) >>> if (ac < 2)

Re: [BUG?] Spaces not allowed in directory names in .git/info/attributes

2016-05-23 Thread Duy Nguyen
On Tue, May 24, 2016 at 3:30 AM, Junio C Hamano wrote: > Nathan Collins writes: > >> Example session: >> >> $ git init test.git >> Initialized empty Git repository in /tmp/test.git/.git/ >> $ cd test.git >> $ mkdir "dir name" >> $ touch dir\ name/file.txt >> $ echo "dir\\

Re: [PATCHv8 0/5] pathspec magic extension to search for attributes

2016-05-23 Thread Duy Nguyen
On Tue, May 24, 2016 at 1:49 AM, Stefan Beller wrote: > On Sun, May 22, 2016 at 4:45 AM, Duy Nguyen wrote: >> On Fri, May 20, 2016 at 4:25 AM, Stefan Beller wrote: >>>> My take is to pretend sparse checkout does not exist at all and then >>>> go from ther

Re: Reviews for the first patches of pclouds/narrow-checkout

2016-05-24 Thread Duy Nguyen
On Tue, May 24, 2016 at 1:26 AM, Stefan Beller wrote: > Hi, > > so I started looking into your narrow checkout branch and started reviewing > the patches. Thanks for working on the narrow checkout! > > Reviewed-by: Stefan Beller (just asking for signoff) > tree.c: break long lines > read-

Re: [WIP PATCH 00/14] Protocol v2 patches

2016-05-24 Thread Duy Nguyen
On Wed, May 25, 2016 at 5:46 AM, David Turner wrote: > I was looking at this again today, and noticed that it doesn't really > address the HTTP case. > > The central problem is that protocol v2 goes like this: > server: I have capabilities w,x,y, and z > client: I want capabilities x and z. > > Bu

Re: [PATCH 4/6] config: return configset value for current_config_ functions

2016-05-26 Thread Duy Nguyen
On Thu, May 19, 2016 at 7:08 AM, Jeff King wrote: > On Wed, May 18, 2016 at 06:43:23PM -0400, Jeff King wrote: > >> cache.h| 1 + >> config.c | 51 >> +- >> t/helper/test-config.c | 20 >> t/t1308

Re: [PATCH v2 1/5] worktree.c: add find_worktree_by_path()

2016-05-30 Thread Duy Nguyen
On Mon, May 23, 2016 at 11:11 AM, Eric Sunshine wrote: > On Sun, May 22, 2016 at 6:43 AM, Nguyễn Thái Ngọc Duy > wrote: >> So far we haven't needed to identify an existing worktree from command >> line. Future commands such as lock or move will need it. There are of >> course other options for i

Re: git gc and worktrees

2016-05-31 Thread Duy Nguyen
On Tue, May 31, 2016 at 2:07 PM, Johannes Sixt wrote: > Earlier this year I had a largish merge going on in a separate worktree. > With a mix of staged resolutions and unmerged paths in the index, I ran 'git > gc' in the main worktree. This removed a lot of objects that were recorded > in that sep

Re: [PATCH] format_commit_message: honor `color=auto` for `%C(auto)`

2016-05-31 Thread Duy Nguyen
On Thu, May 26, 2016 at 5:39 AM, Jeff King wrote: > On Tue, May 24, 2016 at 08:56:49PM -0500, Edward Thomson wrote: > >> Check that we are configured to display colors in the given context when >> the user specifies a format string of `%C(auto)`. This brings that >> behavior in line with the beha

Re: [PATCH v2 4/4] bundle v3: the beginning

2016-05-31 Thread Duy Nguyen
On Fri, May 20, 2016 at 7:39 PM, Christian Couder wrote: > I am responding to this 2+ month old email because I am investigating > adding an alternate object store at the same level as loose and packed > objects. This alternate object store could be used for large files. I > am working on this for

Re: [PATCH v3 4/6] worktree.c: retrieve lock status (and optionally reason) in get_worktrees()

2016-06-01 Thread Duy Nguyen
On Wed, Jun 1, 2016 at 12:55 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> We need this later to avoid double locking a worktree, or unlocking one >> when it's not even locked. > > Shouldn't this be done lazily? > > If a user is working in worktree B and is not doing anything fun

Re: [PATCH v3 6/6] worktree: add "unlock" command

2016-06-01 Thread Duy Nguyen
On Wed, Jun 1, 2016 at 1:12 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> + if (is_main_worktree(wt)) >> + die(_("'%s' is a main working directory"), av[0]); >> + if (!wt->lock_reason) >> + die(_("'%s' is not locked"), av[0]); > > Exactly the same

Re: [PATCH v3 2/6] worktree.c: find_worktree() learns to identify worktrees by basename

2016-06-01 Thread Duy Nguyen
On Wed, Jun 1, 2016 at 12:51 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> This allows the user to do something like "worktree lock foo" instead of >> "worktree lock ". With completion support it could be quite >> convenient. While this base name search can be done in the same wo

Re: [PATCH v2 4/4] bundle v3: the beginning

2016-06-01 Thread Duy Nguyen
On Tue, May 31, 2016 at 8:18 PM, Christian Couder wrote: >>> I wonder if this mechanism could also be used or extended to clone and >>> fetch an alternate object database. >>> >>> In [1], [2] and [3], and this was also discussed during the >>> Contributor Summit last month, Peff says that he start

Re: [PATCH v2 4/4] bundle v3: the beginning

2016-06-01 Thread Duy Nguyen
On Tue, May 31, 2016 at 8:18 PM, Christian Couder wrote: >>> [3] >>> http://thread.gmane.org/gmane.comp.version-control.git/202902/focus=203020 >> >> This points to https://github.com/peff/git/commits/jk/external-odb >> which is dead. Jeff, do you still have it somewhere, or is it not >> worth l

Re: Segfault in the attr stack

2016-06-01 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 5:17 AM, Junio C Hamano wrote: > Gaah, of course. > > This is coming from the cache preload codepath, where multiple threads > try to run ce_path_match(). > It used to be OK because pathspec magic never looked at attributes, > but now it does, and attribute system is not thr

Re: Segfault in the attr stack

2016-06-01 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 8:02 AM, Duy Nguyen wrote: > On Thu, Jun 2, 2016 at 5:17 AM, Junio C Hamano wrote: >> Gaah, of course. >> >> This is coming from the cache preload codepath, where multiple threads >> try to run ce_path_match(). >> It used to be OK becau

Re: [PATCH 2/4] reachable.c: mark reachable objects in index from all worktrees

2016-06-02 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 1:13 AM, Eric Sunshine wrote: > On Wed, Jun 1, 2016 at 6:45 AM, Nguyễn Thái Ngọc Duy > wrote: >> Current mark_reachable_objects() only marks objects from index from >> _current_ worktree as reachable instead of all worktrees. Because this >> function is used for pruning, t

Re: [PATCH 2/4] reachable.c: mark reachable objects in index from all worktrees

2016-06-02 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 1:57 AM, David Turner wrote: >> + struct index_state istate; >> + >> + memset(&istate, 0, sizeof(istate)); > > > Why not just struct index_state istate = {0}; ? > My first thought was.. "hmm.. C99?" but then there are 24 of them in the code base alre

Re: [PATCH v3 2/6] worktree.c: find_worktree() learns to identify worktrees by basename

2016-06-02 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 1:44 AM, Junio C Hamano wrote: >> We would >> need to convert or match both '/' and '\' in "to/foo" case because of >> Windows, so it's not much easier than basename(). > > I never said "easier to implement". But can this codepath get > backslashed paths in the first place?

Re: [PATCH 0/4] Fix prune/gc problem with multiple worktrees

2016-06-02 Thread Duy Nguyen
(from patch 4/4 mail) On Wed, Jun 1, 2016 at 10:51 PM, Michael Haggerty wrote: >> + path = xstrdup(worktree_git_path(wt, "logs/refs/bisect")); >> + if (file_exists(path)) >> + handle_one_reflog(path, NULL, 0, &cb); >> + free(path); >> +} > > `refs/bisect` is not a single r

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-06-02 Thread Duy Nguyen
On Mon, May 30, 2016 at 2:55 PM, Michael Haggerty wrote: > Currently, the API for iterating over references is via a family of > for_each_ref()-type functions that invoke a callback function for each > selected reference. All of these eventually call do_for_each_ref(), > which knows how to do one

Re: [PATCH 1/2] fetch: better alignment in ref summary

2016-06-02 Thread Duy Nguyen
On Mon, May 23, 2016 at 7:58 AM, Junio C Hamano wrote: > That is, I wonder if the above can become something like: > >> From github.com:pclouds/git >> * [new branch] { -> pclouds/}2nd-index >> * [new branch] { -> pclouds/}3nd-index >> * [new branch] { -> pclouds/}file-watcher >>

Re: [PATCH v3 2/6] worktree.c: find_worktree() learns to identify worktrees by basename

2016-06-03 Thread Duy Nguyen
On Thu, Jun 2, 2016 at 11:49 PM, Junio C Hamano wrote: > +static struct worktree *find_worktree_by_basename(struct worktree **list, > + const char *base_name) > +{ > + struct worktree *found = NULL; > + int nr_found = 0; > + > + for

Re: [PATCH v2 3/3] fetch: reduce duplicate in ref update status lines

2016-06-03 Thread Duy Nguyen
On Sat, Jun 4, 2016 at 12:00 AM, Junio C Hamano wrote: > > Nguyễn Thái Ngọc Duy writes: > > > +static int common_suffix_length(const char *a, const char *b) > > +{ > > + const char *pa = a + strlen(a); > > + const char *pb = b + strlen(b); > > + int count = 0; > > + > > + while (

Re: [PATCH v2 3/3] fetch: reduce duplicate in ref update status lines

2016-06-03 Thread Duy Nguyen
On Sat, Jun 4, 2016 at 12:06 AM, Jeff King wrote: > On Fri, Jun 03, 2016 at 06:08:43PM +0700, Nguyễn Thái Ngọc Duy wrote: > >> When there are lots of ref updates, each has different name length, this >> will make it easier to look because the variable part is at the end. > > Is it worth handling m

Re: [PATCH v2 3/3] fetch: reduce duplicate in ref update status lines

2016-06-03 Thread Duy Nguyen
On Fri, Jun 03, 2016 at 10:53:27AM -0400, Marc Branchaud wrote: > On 2016-06-03 07:08 AM, Nguyễn Thái Ngọc Duy wrote: > > When there are lots of ref updates, each has different name length, this > > will make it easier to look because the variable part is at the end. > > s/look/read/ > > For the

Re: [PATCH v2 3/3] fetch: reduce duplicate in ref update status lines

2016-06-03 Thread Duy Nguyen
On Sat, Jun 4, 2016 at 3:53 AM, Junio C Hamano wrote: > By punting on the effort to find a readable format that does not > repeat the same info twice, we are sending a signal to the users > that they cannot use a meaningful sentence as the name of a branch > name; they need to stay within a relati

Re: [PATCH v2 3/3] fetch: reduce duplicate in ref update status lines

2016-06-04 Thread Duy Nguyen
On Sat, Jun 4, 2016 at 11:30 PM, Junio C Hamano wrote: >> The patch does not do fancy stuff like this yet, but it can because >> lines exceeding terminal width is already excluded from column width >> calculation. So far the output looks good on my terminal (192 chars, >> can't overflow or refname

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