l10n: es: update translation
[git/debian.git] / tmp-objdir.h
blob76efc7edee5be4a9197a242f526c74b05f49802a
1 #ifndef TMP_OBJDIR_H
2 #define TMP_OBJDIR_H
4 /*
5 * This API allows you to create a temporary object directory, advertise it to
6 * sub-processes via GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES,
7 * and then either migrate its object into the main object directory, or remove
8 * it. The library handles unexpected signal/exit death by cleaning up the
9 * temporary directory.
11 * Example:
13 * struct tmp_objdir *t = tmp_objdir_create("incoming");
14 * if (!run_command_v_opt_cd_env(cmd, 0, NULL, tmp_objdir_env(t)) &&
15 * !tmp_objdir_migrate(t))
16 * printf("success!\n");
17 * else
18 * die("failed...tmp_objdir will clean up for us");
22 struct tmp_objdir;
25 * Create a new temporary object directory with the specified prefix;
26 * returns NULL on failure.
28 struct tmp_objdir *tmp_objdir_create(const char *prefix);
31 * Return a list of environment strings, suitable for use with
32 * child_process.env, that can be passed to child programs to make use of the
33 * temporary object directory.
35 const char **tmp_objdir_env(const struct tmp_objdir *);
38 * Finalize a temporary object directory by migrating its objects into the main
39 * object database, removing the temporary directory, and freeing any
40 * associated resources.
42 int tmp_objdir_migrate(struct tmp_objdir *);
45 * Destroy a temporary object directory, discarding any objects it contains.
47 int tmp_objdir_destroy(struct tmp_objdir *);
50 * Remove all objects from the temporary object directory, while leaving it
51 * around so more objects can be added.
53 void tmp_objdir_discard_objects(struct tmp_objdir *);
56 * Add the temporary object directory as an alternate object store in the
57 * current process.
59 void tmp_objdir_add_as_alternate(const struct tmp_objdir *);
62 * Replaces the writable object store in the current process with the temporary
63 * object directory and makes the former main object store an alternate.
64 * If will_destroy is nonzero, the object directory may not be migrated.
66 void tmp_objdir_replace_primary_odb(struct tmp_objdir *, int will_destroy);
69 * If the primary object database was replaced by a temporary object directory,
70 * restore it to its original value while keeping the directory contents around.
71 * Returns NULL if the primary object database was not replaced.
73 struct tmp_objdir *tmp_objdir_unapply_primary_odb(void);
76 * Reapplies the former primary temporary object database, after potentially
77 * changing its relative path.
79 void tmp_objdir_reapply_primary_odb(struct tmp_objdir *, const char *old_cwd,
80 const char *new_cwd);
83 #endif /* TMP_OBJDIR_H */