{"thread":{"id":"517","subject":"[PATCH] Do not initialize sha1_file_directory by hand.","startedAt":"2005-05-06T23:32:28Z","lastAt":"2005-05-06T23:32:28Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2720","messageId":"7vsm10aq2b.fsf@assigned-by-dhcp.cox.net","threadId":"517","inReplyTo":null,"subject":"[PATCH] Do not initialize sha1_file_directory by hand.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-06T23:32:28Z","receivedAt":"2005-05-06T23:32:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Some commands initialize sha1_file_directory by hand.  There is no\nneed to do so; sha1_file.c knows how to handle it.\n\nThe next patch will remove the variable altogether.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n ls-tree.c    |    3 ---\n read-cache.c |    5 -----\n tar-tree.c   |    5 -----\n 3 files changed, 13 deletions(-)\n\n--- a/ls-tree.c\n+++ b/ls-tree.c\n@@ -104,9 +104,6 @@ int main(int argc, char **argv)\n \t\tusage(ls_tree_usage);\n \tif (get_sha1(argv[1], sha1) < 0)\n \t\tusage(ls_tree_usage);\n-\tsha1_file_directory = getenv(DB_ENVIRONMENT);\n-\tif (!sha1_file_directory)\n-\t\tsha1_file_directory = DEFAULT_DB_ENVIRONMENT;\n \tif (list(sha1) < 0)\n \t\tdie(\"list failed\");\n \treturn 0;\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -193,11 +193,6 @@ int read_cache(void)\n \tif (active_cache)\n \t\treturn error(\"more than one cachefile\");\n \terrno = ENOENT;\n-\tsha1_file_directory = getenv(DB_ENVIRONMENT);\n-\tif (!sha1_file_directory)\n-\t\tsha1_file_directory = DEFAULT_DB_ENVIRONMENT;\n-\tif (access(sha1_file_directory, X_OK) < 0)\n-\t\treturn error(\"no access to SHA1 file directory\");\n \tfd = open(get_index_file(), O_RDONLY);\n \tif (fd < 0)\n \t\treturn (errno == ENOENT) ? 0 : error(\"open failed\");\n--- a/tar-tree.c\n+++ b/tar-tree.c\n@@ -418,10 +418,6 @@ int main(int argc, char **argv)\n \t\tusage(tar_tree_usage);\n \t}\n \n-\tsha1_file_directory = getenv(DB_ENVIRONMENT);\n-\tif (!sha1_file_directory)\n-\t\tsha1_file_directory = DEFAULT_DB_ENVIRONMENT;\n-\n \tbuffer = read_object_with_reference(sha1, \"commit\", &size, commit_sha1);\n \tif (buffer) {\n \t\twrite_global_extended_header(commit_sha1);\n----------------------------------------------------------------\n\n"}]}