summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-01 06:09:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-04 06:44:32 (GMT)
commit30ca07a249744e57163c02250fca420cea364299 (patch)
tree67cfa219ff2e8e5c293d3f2e7eb475093e354771 /cache.h
parent89815cab95268e8f0f58142b848ac4cd5e9cbdcb (diff)
downloadgit-30ca07a249744e57163c02250fca420cea364299.zip
git-30ca07a249744e57163c02250fca420cea364299.tar.gz
git-30ca07a249744e57163c02250fca420cea364299.tar.bz2
_GIT_INDEX_OUTPUT: allow plumbing to output to an alternative index file.
When defined, this allows plumbing commands that update the index (add, apply, checkout-index, merge-recursive, mv, read-tree, rm, update-index, and write-tree) to write their resulting index to an alternative index file while holding a lock to the original index file. With this, git-commit that jumps the index does not have to make an extra copy of the index file, and more importantly, it can do the update while holding the lock on the index. However, I think the interface to let an environment variable specify the output is a mistake, as shown in the documentation. If a curious user has the environment variable set to something other than the file GIT_INDEX_FILE points at, almost everything will break. This should instead be a command line parameter to tell these plumbing commands to write the result in the named file, to prevent stupid mistakes. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 384b260..59a05c1 100644
--- a/cache.h
+++ b/cache.h
@@ -147,6 +147,7 @@ enum object_type {
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
+#define INDEX_OUTPUT_ENVIRONMENT "_GIT_INDEX_OUTPUT"
#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
#define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
#define CONFIG_ENVIRONMENT "GIT_CONFIG"
@@ -212,6 +213,10 @@ struct lock_file {
};
extern int hold_lock_file_for_update(struct lock_file *, const char *path, int);
extern int commit_lock_file(struct lock_file *);
+
+extern int hold_locked_index(struct lock_file *, int);
+extern int commit_locked_index(struct lock_file *);
+
extern void rollback_lock_file(struct lock_file *);
extern int delete_ref(const char *, unsigned char *sha1);