aboutsummaryrefslogtreecommitdiffstats
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-07-05 11:31:32 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-05 11:31:32 -0700
commit723c31fea2f1c4994de837bda9022ffa8b6de1bb (patch)
tree4c8c636dd58a7489cf033f3ac8682aeab453385d /fetch-pack.c
parent7a662e896bcd391265477e304d7af6e5d2ca1deb (diff)
downloadgit-723c31fea2f1c4994de837bda9022ffa8b6de1bb.tar.gz
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 'fetch-pack.c')
-rw-r--r--fetch-pack.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index b8367a4d62..a4c1eccf71 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -72,13 +72,9 @@ static int find_common(int fd[2], unsigned char *result_sha1, unsigned char *rem
static int get_old_sha1(const char *refname, unsigned char *sha1)
{
- static char pathname[PATH_MAX];
- const char *git_dir;
int fd, ret;
- git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
- snprintf(pathname, sizeof(pathname), "%s/%s", git_dir, refname);
- fd = open(pathname, O_RDONLY);
+ fd = open(git_path("%s", refname), O_RDONLY);
ret = -1;
if (fd >= 0) {
char buffer[60];