From: Jonas Fonseca <fonseca@diku.dk>
To: torvalds@osdl.org
Cc: git@vger.kernel.org
Subject: [PATCH] Cleanup sha1_file_directory initialization
Date: Sun, 24 Apr 2005 15:07:30 +0200 [thread overview]
Message-ID: <20050424130730.GA10649@diku.dk> (raw)
Use get_object_directory() when initializing sha1_file_directory
and make sha1_file_name() work on the global.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
Actually the initiailzation in ls-tree.c can be removed because call to
list() will end up in sha1_file_name() which will do it.
commit 6a06750a72231eaf285f9fbd2bcb88a39b699679
tree bec1c4178131a67de1fa639a274b13adec21c1e5
parent 32141512fff2d42c0233c07610db866926c89a75
author Jonas Fonseca <jonas@cvalda.(none)> 1114346881 +0200
committer Jonas Fonseca <jonas@cvalda.(none)> 1114346881 +0200
Index: ls-tree.c
===================================================================
--- 31e9af73983d640090508b06784ef7db4816c957/ls-tree.c (mode:100644 sha1:bd99f9ac7b2d6dc23c1ec7d8f03877c20afec63f)
+++ bec1c4178131a67de1fa639a274b13adec21c1e5/ls-tree.c (mode:100644 sha1:b630f69d8430f18f52799cf32787059b4427f3e8)
@@ -104,9 +104,8 @@ int main(int argc, char **argv)
usage(ls_tree_usage);
if (get_sha1_hex(argv[1], sha1) < 0)
usage(ls_tree_usage);
- sha1_file_directory = getenv(DB_ENVIRONMENT);
- if (!sha1_file_directory)
- sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
+
+ sha1_file_directory = get_object_directory();
if (list(sha1) < 0)
die("list failed");
return 0;
Index: read-cache.c
===================================================================
--- 31e9af73983d640090508b06784ef7db4816c957/read-cache.c (mode:100644 sha1:f67aceb6b12f6d9cadf6a80bb1d33cf1bcd7f619)
+++ bec1c4178131a67de1fa639a274b13adec21c1e5/read-cache.c (mode:100644 sha1:deb60df8cbb4f9ec8367f4ff96c62e383b5699e8)
@@ -183,9 +183,7 @@ int read_cache(void)
if (active_cache)
return error("more than one cachefile");
errno = ENOENT;
- sha1_file_directory = getenv(DB_ENVIRONMENT);
- if (!sha1_file_directory)
- sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
+ sha1_file_directory = get_object_directory();
if (access(sha1_file_directory, X_OK) < 0)
return error("no access to SHA1 file directory");
fd = open(get_index_file(), O_RDONLY);
Index: sha1_file.c
===================================================================
--- 31e9af73983d640090508b06784ef7db4816c957/sha1_file.c (mode:100644 sha1:97a515a073fec5870dfaaa279868ce9330853d3d)
+++ bec1c4178131a67de1fa639a274b13adec21c1e5/sha1_file.c (mode:100644 sha1:94ab1119383a00a821254c3454fe349845027346)
@@ -71,8 +71,11 @@ char *sha1_file_name(const unsigned char
static char *name, *base;
if (!base) {
- char *sha1_file_directory = getenv(DB_ENVIRONMENT) ? : DEFAULT_DB_ENVIRONMENT;
- int len = strlen(sha1_file_directory);
+ int len;
+
+ if (!sha1_file_directory)
+ sha1_file_directory = get_object_directory();
+ len = strlen(sha1_file_directory);
base = malloc(len + 60);
memcpy(base, sha1_file_directory, len);
memset(base+len, 0, 60);
--
Jonas Fonseca
reply other threads:[~2005-04-24 13:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050424130730.GA10649@diku.dk \
--to=fonseca@diku.dk \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.