Re: [PATCH/RFC v2 15/16] update-index.c: add a force-rewrite option

2012-08-08 Thread Thomas Gummerer
On 08/05, Junio C Hamano wrote:
 Thomas Gummerer t.gumme...@gmail.com writes:
 
  Add a force-rewrite option to update-index, which allows the user
  to rewrite the index, even if there are no changes. This can be used
  to do performance tests of both the reader and the writer.
 
  Signed-off-by: Thomas Gummerer t.gumme...@gmail.com
  ---
   builtin/update-index.c |5 -
   1 file changed, 4 insertions(+), 1 deletion(-)
 
 I do not think this is wrong per-se, but is a new command that needs
 to be documented?  If it is only for benchmarking and debugging, it
 might be sufficient to make --index-version n always rewrite the
 index.

The command is only for benchmarking, I don't see another case where
it makes sense for anyone to rewrite the whole index, without changing
anything. I've made --index-version rewrite the index for the re-roll.

  diff --git a/builtin/update-index.c b/builtin/update-index.c
  index 4ce341c..7fedc8f 100644
  --- a/builtin/update-index.c
  +++ b/builtin/update-index.c
  @@ -24,6 +24,7 @@ static int allow_remove;
   static int allow_replace;
   static int info_only;
   static int force_remove;
  +static int force_rewrite;
   static int verbose;
   static int mark_valid_only;
   static int mark_skip_worktree_only;
  @@ -728,6 +729,8 @@ int cmd_update_index(int argc, const char **argv, const 
  char *prefix)
  OPT_BIT(0, unmerged, refresh_args.flags,
  refresh even if index contains unmerged entries,
  REFRESH_UNMERGED),
  +   OPT_SET_INT(0, force-rewrite, force_rewrite,
  +   force a index rewrite even if there is no change, 1),
  {OPTION_CALLBACK, 0, refresh, refresh_args, NULL,
  refresh stat information,
  PARSE_OPT_NOARG | PARSE_OPT_NONEG,
  @@ -886,7 +889,7 @@ int cmd_update_index(int argc, const char **argv, const 
  char *prefix)
  strbuf_release(buf);
  }
   
  -   if (active_cache_changed) {
  +   if (active_cache_changed || force_rewrite) {
  if (newfd  0) {
  if (refresh_args.flags  REFRESH_QUIET)
  exit(128);
--
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/RFC v2 15/16] update-index.c: add a force-rewrite option

2012-08-05 Thread Thomas Gummerer
Add a force-rewrite option to update-index, which allows the user
to rewrite the index, even if there are no changes. This can be used
to do performance tests of both the reader and the writer.

Signed-off-by: Thomas Gummerer t.gumme...@gmail.com
---
 builtin/update-index.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/update-index.c b/builtin/update-index.c
index 4ce341c..7fedc8f 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -24,6 +24,7 @@ static int allow_remove;
 static int allow_replace;
 static int info_only;
 static int force_remove;
+static int force_rewrite;
 static int verbose;
 static int mark_valid_only;
 static int mark_skip_worktree_only;
@@ -728,6 +729,8 @@ int cmd_update_index(int argc, const char **argv, const 
char *prefix)
OPT_BIT(0, unmerged, refresh_args.flags,
refresh even if index contains unmerged entries,
REFRESH_UNMERGED),
+   OPT_SET_INT(0, force-rewrite, force_rewrite,
+   force a index rewrite even if there is no change, 1),
{OPTION_CALLBACK, 0, refresh, refresh_args, NULL,
refresh stat information,
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
@@ -886,7 +889,7 @@ int cmd_update_index(int argc, const char **argv, const 
char *prefix)
strbuf_release(buf);
}
 
-   if (active_cache_changed) {
+   if (active_cache_changed || force_rewrite) {
if (newfd  0) {
if (refresh_args.flags  REFRESH_QUIET)
exit(128);
-- 
1.7.10.GIT

--
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/RFC v2 15/16] update-index.c: add a force-rewrite option

2012-08-05 Thread Junio C Hamano
Thomas Gummerer t.gumme...@gmail.com writes:

 Add a force-rewrite option to update-index, which allows the user
 to rewrite the index, even if there are no changes. This can be used
 to do performance tests of both the reader and the writer.

 Signed-off-by: Thomas Gummerer t.gumme...@gmail.com
 ---
  builtin/update-index.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

I do not think this is wrong per-se, but is a new command that needs
to be documented?  If it is only for benchmarking and debugging, it
might be sufficient to make --index-version n always rewrite the
index.

 diff --git a/builtin/update-index.c b/builtin/update-index.c
 index 4ce341c..7fedc8f 100644
 --- a/builtin/update-index.c
 +++ b/builtin/update-index.c
 @@ -24,6 +24,7 @@ static int allow_remove;
  static int allow_replace;
  static int info_only;
  static int force_remove;
 +static int force_rewrite;
  static int verbose;
  static int mark_valid_only;
  static int mark_skip_worktree_only;
 @@ -728,6 +729,8 @@ int cmd_update_index(int argc, const char **argv, const 
 char *prefix)
   OPT_BIT(0, unmerged, refresh_args.flags,
   refresh even if index contains unmerged entries,
   REFRESH_UNMERGED),
 + OPT_SET_INT(0, force-rewrite, force_rewrite,
 + force a index rewrite even if there is no change, 1),
   {OPTION_CALLBACK, 0, refresh, refresh_args, NULL,
   refresh stat information,
   PARSE_OPT_NOARG | PARSE_OPT_NONEG,
 @@ -886,7 +889,7 @@ int cmd_update_index(int argc, const char **argv, const 
 char *prefix)
   strbuf_release(buf);
   }
  
 - if (active_cache_changed) {
 + if (active_cache_changed || force_rewrite) {
   if (newfd  0) {
   if (refresh_args.flags  REFRESH_QUIET)
   exit(128);
--
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