git_dir = getenv(GIT_DIR_ENVIRONMENT);
if (!git_dir) {
if (!startup_info->have_repository)
- die("BUG: setup_git_env called without repository");
+ BUG("setup_git_env called without repository");
git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
}
gitfile = read_gitfile(git_dir);
const char *get_git_common_dir(void)
{
+ if (!git_dir)
+ setup_git_env();
return git_common_dir;
}
#define PRIo32 "o"
#endif
+typedef uintmax_t timestamp_t;
+#define PRItime PRIuMAX
+#define parse_timestamp strtoumax
+#define TIME_MAX UINTMAX_MAX
+
#ifndef PATH_SEP
#define PATH_SEP ':'
#endif
#endif
#define DEFAULT_PACKED_GIT_LIMIT \
- ((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? 8192 : 256))
+ ((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? (32 * 1024L * 1024L) : 256))
#ifdef NO_PREAD
#define pread git_pread
#define HAVE_VARIADIC_MACROS 1
#endif
+ #ifdef HAVE_VARIADIC_MACROS
+ __attribute__((format (printf, 3, 4))) NORETURN
+ void BUG_fl(const char *file, int line, const char *fmt, ...);
+ #define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__)
+ #else
+ __attribute__((format (printf, 1, 2))) NORETURN
+ void BUG(const char *fmt, ...);
+ #endif
+
/*
* Preserves errno, prints a message, but gives no warning for ENOENT.
* Returns 0 on success, which includes trying to unlink an object that does