# [PATCH] Allow GIT_DIR to be an absolute path

1 messages from 2005-11-06 to 2005-11-06. Participants: Johannes Schindelin.
Thread: https://gitlist.dev/t/2375

## Johannes Schindelin, 2005-11-06 23:36

Subject: [PATCH] Allow GIT_DIR to be an absolute path
Message-ID: <Pine.LNX.4.63.0511070034160.23992@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0511070034160.23992%40wbgn013.biozentrum.uni-wuerzburg.de

```

This fixes a problem in safe_create_leading_directories() when the
argument starts with a '/' (i.e. the path is absolute).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

---

	I did not thoroughly check if there are more places where a 
	relative path is assumed. Could well be the only one.

 sha1_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

applies-to: 8a2743d0d424a3bc0ff120cdba66ee20b59f5a56
e1f7e03e178889c53367745810130ef3e933d2aa
diff --git a/sha1_file.c b/sha1_file.c
index 642f00d..544db4e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -50,7 +50,7 @@ int get_sha1_hex(const char *hex, unsign
 
 int safe_create_leading_directories(char *path)
 {
-	char *pos = path;
+	char *pos = path+1;
 
 	while (pos) {
 		pos = strchr(pos, '/');
---
0.99.9.GIT

```
