From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Pete Wyckoff <pw@padd.com>,
git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] cherry-pick/revert: transparently refresh index
Date: Mon, 1 Nov 2010 15:44:43 +0700 [thread overview]
Message-ID: <AANLkTimqpwgvHS7+Q98RPrtD+j7gN7T3-ZrJDCLBq0sF@mail.gmail.com> (raw)
In-Reply-To: <20101031195933.GA21240@burratino>
> +static void read_and_refresh_cache(const char *me)
> +{
> + static struct lock_file index_lock;
> + int index_fd = hold_locked_index(&index_lock, 0);
> + if (read_index_preload(&the_index, NULL) < 0)
> + die("git %s: failed to read the index", me);
> + refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
Can we refresh only index entries that are cherry-picked/reverted?
Full refresh can be expensive on large repos while these operations
don't usually touch the whole repo.
I'm thinking of adding ce_really_uptodate() and converting most of
ce_uptodate() call sites to the new one.
diff --git a/cache.h b/cache.h
index 123dd4b..81dc5cf 100644
--- a/cache.h
+++ b/cache.h
@@ -240,6 +240,7 @@ static inline size_t ce_namelen(const struct
cache_entry *ce)
ondisk_cache_entry_size(ce_namelen(ce)))
#define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)
#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
+#define ce_really_uptodate(ce) (ce_uptodate(ce) ||
(refresh_cache_entry(ce), ce_uptodate(ce)))
#define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
@@ -512,6 +513,7 @@ extern void fill_stat_cache_info(struct
cache_entry *ce, struct stat *st);
#define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */
#define REFRESH_IN_PORCELAIN 0x0020 /* user friendly output, not
"needs update" */
extern int refresh_index(struct index_state *, unsigned int flags,
const char **pathspec, char *seen, char *header_msg);
+extern struct cache_entry *refresh_cache_entry(struct cache_entry
*ce, int really);
struct lock_file {
struct lock_file *next;
diff --git a/read-cache.c b/read-cache.c
index 1f42473..76525a9 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1156,7 +1156,7 @@ int refresh_index(struct index_state *istate,
unsigned int flags, const char **p
return has_errors;
}
-static struct cache_entry *refresh_cache_entry(struct cache_entry
*ce, int really)
+struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
{
return refresh_cache_ent(&the_index, ce, really, NULL);
}
--
Duy
prev parent reply other threads:[~2010-11-01 8:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-31 17:44 index rebuild for cloned repo Pete Wyckoff
2010-10-31 18:07 ` Jonathan Nieder
2010-10-31 19:59 ` [PATCH] cherry-pick/revert: transparently refresh index Jonathan Nieder
2010-10-31 20:26 ` Andreas Schwab
2010-10-31 20:32 ` Jonathan Nieder
2010-10-31 22:26 ` Pete Wyckoff
2010-10-31 22:28 ` [PATCH] teach update-index --refresh about --data-unchanged Pete Wyckoff
2010-11-03 17:37 ` Junio C Hamano
2010-11-03 18:36 ` Jonathan Nieder
2010-11-03 22:02 ` Pete Wyckoff
2010-11-14 16:58 ` Pete Wyckoff
2010-11-14 17:34 ` Jonathan Nieder
2010-11-01 8:09 ` [PATCH] cherry-pick/revert: transparently refresh index Johannes Sixt
2010-11-03 17:30 ` Junio C Hamano
2010-11-03 20:33 ` Johannes Sixt
2010-11-01 8:44 ` Nguyen Thai Ngoc Duy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimqpwgvHS7+Q98RPrtD+j7gN7T3-ZrJDCLBq0sF@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=pw@padd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).