commit - d9b4d0c08e6fbfa54a11af8518a888425632c912
commit + 66cba96f002a13482c34efaaf5ace08a33f45ec4
blob - 72d9e46a78e681b87484330a8bff24cf22c5be07
blob + 93751d15f248e33311d9591c8be94427dd8279f6
--- lib/fetch.c
+++ lib/fetch.c
fetchfd = -1;
- if (asprintf(&path, "%s/objects/path", repo_path) == -1) {
- err = got_error_from_errno("asprintf");
- goto done;
- }
- err = got_path_mkdir(path);
- free(path);
- if (err)
- goto done;
- if (asprintf(&path, "%s/objects/path/fetching.pack", repo_path) == -1) {
+ if (asprintf(&path, "%s/%s/fetching.pack",
+ repo_path, GOT_OBJECTS_PACK_DIR) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
err = got_error_from_errno("dup");
goto done;
}
- if (asprintf(&path, "%s/objects/path/fetching.idx", repo_path) == -1) {
+ if (asprintf(&path, "%s/%s/fetching.idx",
+ repo_path, GOT_OBJECTS_PACK_DIR) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
err = got_object_id_str(&id_str, *pack_hash);
if (err)
goto done;
- if (asprintf(&packpath, "%s/objects/pack/pack-%s.pack",
- repo_path, id_str) == -1) {
+ if (asprintf(&packpath, "%s/%s/pack-%s.pack",
+ repo_path, GOT_OBJECTS_PACK_DIR, id_str) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
- if (asprintf(&idxpath, "%s/objects/pack/pack-%s.idx",
- repo_path, id_str) == -1) {
+ if (asprintf(&idxpath, "%s/%s/pack-%s.idx",
+ repo_path, GOT_OBJECTS_PACK_DIR, id_str) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
blob - 5b1a4057c54cc2ec9b693ef8ab547dd324ef148c
blob + df440da3c28c0038eb1d0ecb1cf3af9501734493
--- lib/got_lib_repository.h
+++ lib/got_lib_repository.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#define GOT_GIT_DIR ".git"
+
+/* Mandatory files and directories inside the git directory. */
+#define GOT_OBJECTS_DIR "objects"
+#define GOT_REFS_DIR "refs"
+#define GOT_HEAD_FILE "HEAD"
+#define GOT_GITCONFIG "config"
+
+/* Other files and directories inside the git directory. */
+#define GOT_FETCH_HEAD_FILE "FETCH_HEAD"
+#define GOT_ORIG_HEAD_FILE "ORIG_HEAD"
+#define GOT_OBJECTS_PACK_DIR "objects/pack"
+#define GOT_PACKED_REFS_FILE "packed-refs"
+
#define GOT_PACKIDX_CACHE_SIZE 16
#define GOT_PACK_CACHE_SIZE GOT_PACKIDX_CACHE_SIZE
blob - 1b376ccd1c6213845cf4cf8b877850e79bd3c1b5
blob + 734d7b19d5e8436d00ee7297763958bb44a01877
--- lib/repository.c
+++ lib/repository.c
#ifndef nitems
#define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
#endif
-
-#define GOT_GIT_DIR ".git"
-
-/* Mandatory files and directories inside the git directory. */
-#define GOT_OBJECTS_DIR "objects"
-#define GOT_REFS_DIR "refs"
-#define GOT_HEAD_FILE "HEAD"
-#define GOT_GITCONFIG "config"
-
-/* Other files and directories inside the git directory. */
-#define GOT_FETCH_HEAD_FILE "FETCH_HEAD"
-#define GOT_ORIG_HEAD_FILE "ORIG_HEAD"
-#define GOT_OBJECTS_PACK_DIR "objects/pack"
-#define GOT_PACKED_REFS_FILE "packed-refs"
const char *
got_repo_get_path(struct got_repository *repo)