summaryrefslogtreecommitdiff
path: root/send-pack.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-07-05 18:31:32 (GMT)
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-05 18:31:32 (GMT)
commit723c31fea2f1c4994de837bda9022ffa8b6de1bb (patch)
tree4c8c636dd58a7489cf033f3ac8682aeab453385d /send-pack.c
parent7a662e896bcd391265477e304d7af6e5d2ca1deb (diff)
downloadgit-723c31fea2f1c4994de837bda9022ffa8b6de1bb.zip
git-723c31fea2f1c4994de837bda9022ffa8b6de1bb.tar.gz
git-723c31fea2f1c4994de837bda9022ffa8b6de1bb.tar.bz2
Add "git_path()" and "head_ref()" helper functions.
"git_path()" returns a static pathname pointer into the git directory using a printf-like format specifier. "head_ref()" works like "for_each_ref()", except for just the HEAD.
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/send-pack.c b/send-pack.c
index f098acb..7287c3d 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -92,12 +92,9 @@ static int pack_objects(int fd, struct ref *refs)
static int read_ref(const char *ref, unsigned char *sha1)
{
int fd, ret;
- static char pathname[PATH_MAX];
char buffer[60];
- const char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
- snprintf(pathname, sizeof(pathname), "%s/%s", git_dir, ref);
- fd = open(pathname, O_RDONLY);
+ fd = open(git_path("%s", ref), O_RDONLY);
if (fd < 0)
return -1;
ret = -1;