Commit Diff


commit - 63f810e6fee43e699585195a24eebdb53a99a4f4
commit + 61a7d79fef51b4bf48411fcd4542401f10acc626
blob - ae6efb2fcf76c8ebb8e63f36b1aec2528dbae49a
blob + cd15a3ad1b8e6561f202dd4fef0869c1efdc5629
--- include/got_error.h
+++ include/got_error.h
@@ -18,7 +18,7 @@
 #define GOT_ERR_OK		0
 #define GOT_ERR_ERRNO		1
 #define GOT_ERR_NOT_GIT_REPO	2
-#define GOT_ERR_NOT_ABSPATH	3
+/* 3 is currently unused */
 #define GOT_ERR_BAD_PATH	4
 #define GOT_ERR_NOT_REF		5
 #define GOT_ERR_IO		6
@@ -139,7 +139,7 @@ static const struct got_error {
 	{ GOT_ERR_OK,		"no error occured?!?" },
 	{ GOT_ERR_ERRNO,	"see errno" },
 	{ GOT_ERR_NOT_GIT_REPO, "no git repository found" },
-	{ GOT_ERR_NOT_ABSPATH,	"absolute path expected" },
+	{ 3,			"unused error code" },
 	{ GOT_ERR_BAD_PATH,	"bad path" },
 	{ GOT_ERR_NOT_REF,	"no such reference found" },
 	{ GOT_ERR_IO,		"input/output error" },
blob - f8ccc9ef0e7b576e82bc848e98037ce52202878d
blob + ea5232abfd828a7f52894757aaa990fca8c07c9b
--- lib/object.c
+++ lib/object.c
@@ -1636,19 +1636,16 @@ got_object_tree_path_changed(int *changed,
 	size_t seglen;
 
 	*changed = 0;
-
-	/* We are expecting an absolute in-repository path. */
-	if (path[0] != '/')
-		return got_error(GOT_ERR_NOT_ABSPATH);
 
 	/* We not do support comparing the root path. */
-	if (path[1] == '\0')
+	if (got_path_is_root_dir(path))
 		return got_error_path(path, GOT_ERR_BAD_PATH);
 
 	tree1 = tree01;
 	tree2 = tree02;
 	s = path;
-	s++; /* skip leading '/' */
+	while (*s == '/')
+		s++;
 	seg = s;
 	seglen = 0;
 	while (*s) {
blob - 37bda9dd94ab119f94c85d7df3a751715a5a1b8d
blob + d690ffc7275d9e4d25db624b27397f29249f6361
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -445,17 +445,14 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 	size_t seglen;
 
 	*changed = 0;
-
-	/* We are expecting an absolute in-repository path. */
-	if (path[0] != '/')
-		return got_error(GOT_ERR_NOT_ABSPATH);
 
 	/* We not do support comparing the root path. */
-	if (path[1] == '\0')
+	if (got_path_is_root_dir(path))
 		return got_error_path(path, GOT_ERR_BAD_PATH);
 
 	s = path;
-	s++; /* skip leading '/' */
+	while (*s == '/')
+		s++;
 	seg = s;
 	seglen = 0;
 	while (*s) {