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

2016-05-16 Thread David Turner
On Sun, 2016-05-15 at 16:43 +0700, Duy Nguyen wrote:
> On Fri, May 13, 2016 at 3:20 AM, David Turner <
> dtur...@twopensource.com> 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.untrackedCache. It populates after
> reading the index though (in post_read_index_from) not writing, but I
> think it accomplishes the same thing.

OK, I'll drop this one.

> > Signed-off-by: David Turner 
> > ---
> >  Documentation/config.txt | 4 
> >  read-cache.c | 7 ++-
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/config.txt b/Documentation/config.txt
> > index 385ea66..c7b76ef 100644
> > --- a/Documentation/config.txt
> > +++ b/Documentation/config.txt
> > @@ -1848,6 +1848,10 @@ imap::
> > The configuration variables in the 'imap' section are
> > described
> > in linkgit:git-imap-send[1].
> > 
> > +index.adduntrackedcache::
> > +   Automatically populate the untracked cache whenever the
> > index
> > +   is written.
> > +
> >  index.addwatchmanextension::
> > Automatically add the watchman extension to the index
> > whenever
> > it is written.
> > diff --git a/read-cache.c b/read-cache.c
> > index 22c64d0..4a1cccf 100644
> > --- a/read-cache.c
> > +++ b/read-cache.c
> > @@ -2472,7 +2472,7 @@ static int do_write_index(struct index_state
> > *istate, int newfd,
> > int entries = istate->cache_nr;
> > struct stat st;
> > struct strbuf previous_name_buf = STRBUF_INIT,
> > *previous_name;
> > -   int watchman = 0;
> > +   int watchman = 0, untracked = 0;
> > uint64_t start = getnanotime();
> > 
> > for (i = removed = extended = 0; i < entries; i++) {
> > @@ -2502,6 +2502,11 @@ static int do_write_index(struct index_state
> > *istate, int newfd,
> > !the_index.last_update)
> > the_index.last_update = xstrdup("");
> > 
> > +   if (!git_config_get_bool("index.adduntrackedcache",
> > ) &&
> > +   untracked &&
> > +   !istate->untracked)
> > +   add_untracked_cache(_index);
> > +
> > hdr_version = istate->version;
> > 
> > hdr.hdr_signature = htonl(CACHE_SIGNATURE);
> > --
> > 2.4.2.767.g62658d5-twtrsrc
> > 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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.untrackedCache. It populates after
reading the index though (in post_read_index_from) not writing, but I
think it accomplishes the same thing.

> Signed-off-by: David Turner 
> ---
>  Documentation/config.txt | 4 
>  read-cache.c | 7 ++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 385ea66..c7b76ef 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1848,6 +1848,10 @@ imap::
> The configuration variables in the 'imap' section are described
> in linkgit:git-imap-send[1].
>
> +index.adduntrackedcache::
> +   Automatically populate the untracked cache whenever the index
> +   is written.
> +
>  index.addwatchmanextension::
> Automatically add the watchman extension to the index whenever
> it is written.
> diff --git a/read-cache.c b/read-cache.c
> index 22c64d0..4a1cccf 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -2472,7 +2472,7 @@ static int do_write_index(struct index_state *istate, 
> int newfd,
> int entries = istate->cache_nr;
> struct stat st;
> struct strbuf previous_name_buf = STRBUF_INIT, *previous_name;
> -   int watchman = 0;
> +   int watchman = 0, untracked = 0;
> uint64_t start = getnanotime();
>
> for (i = removed = extended = 0; i < entries; i++) {
> @@ -2502,6 +2502,11 @@ static int do_write_index(struct index_state *istate, 
> int newfd,
> !the_index.last_update)
> the_index.last_update = xstrdup("");
>
> +   if (!git_config_get_bool("index.adduntrackedcache", ) &&
> +   untracked &&
> +   !istate->untracked)
> +   add_untracked_cache(_index);
> +
> hdr_version = istate->version;
>
> hdr.hdr_signature = htonl(CACHE_SIGNATURE);
> --
> 2.4.2.767.g62658d5-twtrsrc
>



-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2016-05-12 Thread David Turner
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.

Signed-off-by: David Turner 
---
 Documentation/config.txt | 4 
 read-cache.c | 7 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 385ea66..c7b76ef 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1848,6 +1848,10 @@ imap::
The configuration variables in the 'imap' section are described
in linkgit:git-imap-send[1].
 
+index.adduntrackedcache::
+   Automatically populate the untracked cache whenever the index
+   is written.
+
 index.addwatchmanextension::
Automatically add the watchman extension to the index whenever
it is written.
diff --git a/read-cache.c b/read-cache.c
index 22c64d0..4a1cccf 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2472,7 +2472,7 @@ static int do_write_index(struct index_state *istate, int 
newfd,
int entries = istate->cache_nr;
struct stat st;
struct strbuf previous_name_buf = STRBUF_INIT, *previous_name;
-   int watchman = 0;
+   int watchman = 0, untracked = 0;
uint64_t start = getnanotime();
 
for (i = removed = extended = 0; i < entries; i++) {
@@ -2502,6 +2502,11 @@ static int do_write_index(struct index_state *istate, 
int newfd,
!the_index.last_update)
the_index.last_update = xstrdup("");
 
+   if (!git_config_get_bool("index.adduntrackedcache", ) &&
+   untracked &&
+   !istate->untracked)
+   add_untracked_cache(_index);
+
hdr_version = istate->version;
 
hdr.hdr_signature = htonl(CACHE_SIGNATURE);
-- 
2.4.2.767.g62658d5-twtrsrc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html