Re: [PATCH 3/9] rename "alternate_object_database" to "object_directory"

2018-11-12 Thread Ramsay Jones



On 12/11/2018 15:36, Jeff King wrote:
> On Mon, Nov 12, 2018 at 10:30:55AM -0500, Derrick Stolee wrote:
> 
>> On 11/12/2018 9:48 AM, Jeff King wrote:
>>> In preparation for unifying the handling of alt odb's and the normal
>>> repo object directory, let's use a more neutral name. This patch is
>>> purely mechanical, swapping the type name, and converting any variables
>>> named "alt" to "odb". There should be no functional change, but it will
>>> reduce the noise in subsequent diffs.
>>>
>>> Signed-off-by: Jeff King 
>>> ---
>>> I waffled on calling this object_database instead of object_directory.
>>> But really, it is very specifically about the directory (packed
>>> storage, including packs from alternates, is handled elsewhere).
>>
>> That makes sense. Each alternate makes its own object directory, but is part
>> of a larger object database. It also helps clarify a difference from the
>> object_store.
>>
>> My only complaint is that you have a lot of variable names with "odb" which
>> are now object_directory pointers. Perhaps "odb" -> "objdir"? Or is that
>> just too much change?
> 
> Yeah, that was part of my waffling. ;)
> 
>>From my conversions, usually "objdir" is a string holding the pathname,
> though that's not set in stone. I also like that "odb" is the same short
> length as "alt", which helps with conversion.

While reading the patch, I keep thinking it should be 'obd' for
OBject Directory. ;-)

[Given my track record in naming things, please take with a _huge_
pinch of salt!]

ATB,
Ramsay Jones



Re: [PATCH 3/9] rename "alternate_object_database" to "object_directory"

2018-11-12 Thread Jeff King
On Mon, Nov 12, 2018 at 10:30:55AM -0500, Derrick Stolee wrote:

> On 11/12/2018 9:48 AM, Jeff King wrote:
> > In preparation for unifying the handling of alt odb's and the normal
> > repo object directory, let's use a more neutral name. This patch is
> > purely mechanical, swapping the type name, and converting any variables
> > named "alt" to "odb". There should be no functional change, but it will
> > reduce the noise in subsequent diffs.
> > 
> > Signed-off-by: Jeff King 
> > ---
> > I waffled on calling this object_database instead of object_directory.
> > But really, it is very specifically about the directory (packed
> > storage, including packs from alternates, is handled elsewhere).
> 
> That makes sense. Each alternate makes its own object directory, but is part
> of a larger object database. It also helps clarify a difference from the
> object_store.
> 
> My only complaint is that you have a lot of variable names with "odb" which
> are now object_directory pointers. Perhaps "odb" -> "objdir"? Or is that
> just too much change?

Yeah, that was part of my waffling. ;)

>From my conversions, usually "objdir" is a string holding the pathname,
though that's not set in stone. I also like that "odb" is the same short
length as "alt", which helps with conversion.

But I dunno.

-Peff


Re: [PATCH 3/9] rename "alternate_object_database" to "object_directory"

2018-11-12 Thread Derrick Stolee

On 11/12/2018 9:48 AM, Jeff King wrote:

In preparation for unifying the handling of alt odb's and the normal
repo object directory, let's use a more neutral name. This patch is
purely mechanical, swapping the type name, and converting any variables
named "alt" to "odb". There should be no functional change, but it will
reduce the noise in subsequent diffs.

Signed-off-by: Jeff King 
---
I waffled on calling this object_database instead of object_directory.
But really, it is very specifically about the directory (packed
storage, including packs from alternates, is handled elsewhere).


That makes sense. Each alternate makes its own object directory, but is 
part of a larger object database. It also helps clarify a difference 
from the object_store.


My only complaint is that you have a lot of variable names with "odb" 
which are now object_directory pointers. Perhaps "odb" -> "objdir"? Or 
is that just too much change?




  builtin/count-objects.c |  4 ++--
  builtin/fsck.c  | 16 ++---
  builtin/submodule--helper.c |  6 ++---
  commit-graph.c  | 10 
  object-store.h  | 14 +--
  object.c| 10 
  packfile.c  |  8 +++
  sha1-file.c | 48 ++---
  sha1-name.c | 20 
  transport.c |  2 +-
  10 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index a7cad052c6..3fae474f6f 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -78,10 +78,10 @@ static int count_cruft(const char *basename, const char 
*path, void *data)
return 0;
  }
  
-static int print_alternate(struct alternate_object_database *alt, void *data)

+static int print_alternate(struct object_directory *odb, void *data)
  {
printf("alternate: ");
-   quote_c_style(alt->path, NULL, stdout, 0);
+   quote_c_style(odb->path, NULL, stdout, 0);
putchar('\n');
return 0;
  }
diff --git a/builtin/fsck.c b/builtin/fsck.c
index b10f2b154c..55153cf92a 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -688,7 +688,7 @@ static struct option fsck_opts[] = {
  int cmd_fsck(int argc, const char **argv, const char *prefix)
  {
int i;
-   struct alternate_object_database *alt;
+   struct object_directory *odb;
  
  	/* fsck knows how to handle missing promisor objects */

fetch_if_missing = 0;
@@ -725,14 +725,14 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
for_each_packed_object(mark_packed_for_connectivity, NULL, 0);
} else {
-   struct alternate_object_database *alt_odb_list;
+   struct object_directory *alt_odb_list;
  
  		fsck_object_dir(get_object_directory());
  
  		prepare_alt_odb(the_repository);

alt_odb_list = the_repository->objects->alt_odb_list;
-   for (alt = alt_odb_list; alt; alt = alt->next)
-   fsck_object_dir(alt->path);
+   for (odb = alt_odb_list; odb; odb = odb->next)
+   fsck_object_dir(odb->path);
  
  		if (check_full) {

struct packed_git *p;
@@ -840,12 +840,12 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
errors_found |= ERROR_COMMIT_GRAPH;
  
  		prepare_alt_odb(the_repository);

-   for (alt =  the_repository->objects->alt_odb_list; alt; alt = 
alt->next) {
+   for (odb = the_repository->objects->alt_odb_list; odb; odb = 
odb->next) {
child_process_init(_graph_verify);
commit_graph_verify.argv = verify_argv;
commit_graph_verify.git_cmd = 1;
verify_argv[2] = "--object-dir";
-   verify_argv[3] = alt->path;
+   verify_argv[3] = odb->path;
if (run_command(_graph_verify))
errors_found |= ERROR_COMMIT_GRAPH;
}
@@ -861,12 +861,12 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
errors_found |= ERROR_COMMIT_GRAPH;
  
  		prepare_alt_odb(the_repository);

-   for (alt =  the_repository->objects->alt_odb_list; alt; alt = 
alt->next) {
+   for (odb = the_repository->objects->alt_odb_list; odb; odb = 
odb->next) {
child_process_init(_verify);
midx_verify.argv = midx_argv;
midx_verify.git_cmd = 1;
midx_argv[2] = "--object-dir";
-   midx_argv[3] = alt->path;
+   midx_argv[3] = odb->path;
if (run_command(_verify))
errors_found |= 

[PATCH 3/9] rename "alternate_object_database" to "object_directory"

2018-11-12 Thread Jeff King
In preparation for unifying the handling of alt odb's and the normal
repo object directory, let's use a more neutral name. This patch is
purely mechanical, swapping the type name, and converting any variables
named "alt" to "odb". There should be no functional change, but it will
reduce the noise in subsequent diffs.

Signed-off-by: Jeff King 
---
I waffled on calling this object_database instead of object_directory.
But really, it is very specifically about the directory (packed
storage, including packs from alternates, is handled elsewhere).

 builtin/count-objects.c |  4 ++--
 builtin/fsck.c  | 16 ++---
 builtin/submodule--helper.c |  6 ++---
 commit-graph.c  | 10 
 object-store.h  | 14 +--
 object.c| 10 
 packfile.c  |  8 +++
 sha1-file.c | 48 ++---
 sha1-name.c | 20 
 transport.c |  2 +-
 10 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index a7cad052c6..3fae474f6f 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -78,10 +78,10 @@ static int count_cruft(const char *basename, const char 
*path, void *data)
return 0;
 }
 
-static int print_alternate(struct alternate_object_database *alt, void *data)
+static int print_alternate(struct object_directory *odb, void *data)
 {
printf("alternate: ");
-   quote_c_style(alt->path, NULL, stdout, 0);
+   quote_c_style(odb->path, NULL, stdout, 0);
putchar('\n');
return 0;
 }
diff --git a/builtin/fsck.c b/builtin/fsck.c
index b10f2b154c..55153cf92a 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -688,7 +688,7 @@ static struct option fsck_opts[] = {
 int cmd_fsck(int argc, const char **argv, const char *prefix)
 {
int i;
-   struct alternate_object_database *alt;
+   struct object_directory *odb;
 
/* fsck knows how to handle missing promisor objects */
fetch_if_missing = 0;
@@ -725,14 +725,14 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
for_each_packed_object(mark_packed_for_connectivity, NULL, 0);
} else {
-   struct alternate_object_database *alt_odb_list;
+   struct object_directory *alt_odb_list;
 
fsck_object_dir(get_object_directory());
 
prepare_alt_odb(the_repository);
alt_odb_list = the_repository->objects->alt_odb_list;
-   for (alt = alt_odb_list; alt; alt = alt->next)
-   fsck_object_dir(alt->path);
+   for (odb = alt_odb_list; odb; odb = odb->next)
+   fsck_object_dir(odb->path);
 
if (check_full) {
struct packed_git *p;
@@ -840,12 +840,12 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
errors_found |= ERROR_COMMIT_GRAPH;
 
prepare_alt_odb(the_repository);
-   for (alt =  the_repository->objects->alt_odb_list; alt; alt = 
alt->next) {
+   for (odb = the_repository->objects->alt_odb_list; odb; odb = 
odb->next) {
child_process_init(_graph_verify);
commit_graph_verify.argv = verify_argv;
commit_graph_verify.git_cmd = 1;
verify_argv[2] = "--object-dir";
-   verify_argv[3] = alt->path;
+   verify_argv[3] = odb->path;
if (run_command(_graph_verify))
errors_found |= ERROR_COMMIT_GRAPH;
}
@@ -861,12 +861,12 @@ int cmd_fsck(int argc, const char **argv, const char 
*prefix)
errors_found |= ERROR_COMMIT_GRAPH;
 
prepare_alt_odb(the_repository);
-   for (alt =  the_repository->objects->alt_odb_list; alt; alt = 
alt->next) {
+   for (odb = the_repository->objects->alt_odb_list; odb; odb = 
odb->next) {
child_process_init(_verify);
midx_verify.argv = midx_argv;
midx_verify.git_cmd = 1;
midx_argv[2] = "--object-dir";
-   midx_argv[3] = alt->path;
+   midx_argv[3] = odb->path;
if (run_command(_verify))
errors_found |= ERROR_COMMIT_GRAPH;
}
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 28b9449e82..3ae451bc46 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1265,7 +1265,7 @@ struct submodule_alternate_setup {
SUBMODULE_ALTERNATE_ERROR_IGNORE, NULL }
 
 static int