summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea3cd5c)
raw | patch | inline | side by side (parent: ea3cd5c)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Thu, 17 Apr 2008 23:32:30 +0000 (19:32 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 May 2008 00:41:44 +0000 (17:41 -0700) |
This is in the core so that, if the alternates file has already been
read, the addition can be parsed and put into effect for the current
process.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read, the addition can be parsed and put into effect for the current
process.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
sha1_file.c | patch | blob | history |
index 396eabf6ed02214f2c9f9e83c06c19aa7b7626e4..9da9179afd035cf4cc5ae403344d872950d6d3b3 100644 (file)
--- a/cache.h
+++ b/cache.h
char base[FLEX_ARRAY]; /* more */
} *alt_odb_list;
extern void prepare_alt_odb(void);
+extern void add_to_alternates_file(const char *reference);
struct pack_window {
struct pack_window *next;
diff --git a/sha1_file.c b/sha1_file.c
index 3516777bc7614c23da02dd7a9aa28a48294d56cb..d21e23b4647225af0c38bb70f8b3140972367f3e 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
munmap(map, mapsz);
}
+void add_to_alternates_file(const char *reference)
+{
+ struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
+ int fd = hold_lock_file_for_append(lock, git_path("objects/info/alternates"), 1);
+ char *alt = mkpath("%s/objects\n", reference);
+ write_or_die(fd, alt, strlen(alt));
+ if (commit_lock_file(lock))
+ die("could not close alternates file");
+ if (alt_odb_tail)
+ link_alt_odb_entries(alt, alt + strlen(alt), '\n', NULL, 0);
+}
+
void prepare_alt_odb(void)
{
const char *alt;