Blame include/git2/tree.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_git_tree_h__
Packit Service 20376f
#define INCLUDE_git_tree_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "types.h"
Packit Service 20376f
#include "oid.h"
Packit Service 20376f
#include "object.h"
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * @file git2/tree.h
Packit Service 20376f
 * @brief Git tree parsing, loading routines
Packit Service 20376f
 * @defgroup git_tree Git tree parsing, loading routines
Packit Service 20376f
 * @ingroup Git
Packit Service 20376f
 * @{
Packit Service 20376f
 */
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a tree object from the repository.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer to the looked up tree
Packit Service 20376f
 * @param repo The repo to use when locating the tree.
Packit Service 20376f
 * @param id Identity of the tree to locate.
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_lookup(
Packit Service 20376f
	git_tree **out, git_repository *repo, const git_oid *id);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a tree object from the repository,
Packit Service 20376f
 * given a prefix of its identifier (short id).
Packit Service 20376f
 *
Packit Service 20376f
 * @see git_object_lookup_prefix
Packit Service 20376f
 *
Packit Service 20376f
 * @param out pointer to the looked up tree
Packit Service 20376f
 * @param repo the repo to use when locating the tree.
Packit Service 20376f
 * @param id identity of the tree to locate.
Packit Service 20376f
 * @param len the length of the short identifier
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_lookup_prefix(
Packit Service 20376f
	git_tree **out,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const git_oid *id,
Packit Service 20376f
	size_t len);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Close an open tree
Packit Service 20376f
 *
Packit Service 20376f
 * You can no longer use the git_tree pointer after this call.
Packit Service 20376f
 *
Packit Service 20376f
 * IMPORTANT: You MUST call this method when you stop using a tree to
Packit Service 20376f
 * release memory. Failure to do so will cause a memory leak.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree The tree to close
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_tree_free(git_tree *tree);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the id of a tree.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree a previously loaded tree.
Packit Service 20376f
 * @return object identity for the tree.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_oid *) git_tree_id(const git_tree *tree);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the repository that contains the tree.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree A previously loaded tree.
Packit Service 20376f
 * @return Repository that contains this tree.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(git_repository *) git_tree_owner(const git_tree *tree);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the number of entries listed in a tree
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree a previously loaded tree.
Packit Service 20376f
 * @return the number of entries in the tree
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(size_t) git_tree_entrycount(const git_tree *tree);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a tree entry by its filename
Packit Service 20376f
 *
Packit Service 20376f
 * This returns a git_tree_entry that is owned by the git_tree.  You don't
Packit Service 20376f
 * have to free it, but you must not use it after the git_tree is released.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree a previously loaded tree.
Packit Service 20376f
 * @param filename the filename of the desired entry
Packit Service 20376f
 * @return the tree entry; NULL if not found
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byname(
Packit Service 20376f
	const git_tree *tree, const char *filename);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a tree entry by its position in the tree
Packit Service 20376f
 *
Packit Service 20376f
 * This returns a git_tree_entry that is owned by the git_tree.  You don't
Packit Service 20376f
 * have to free it, but you must not use it after the git_tree is released.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree a previously loaded tree.
Packit Service 20376f
 * @param idx the position in the entry list
Packit Service 20376f
 * @return the tree entry; NULL if not found
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byindex(
Packit Service 20376f
	const git_tree *tree, size_t idx);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a tree entry by SHA value.
Packit Service 20376f
 *
Packit Service 20376f
 * This returns a git_tree_entry that is owned by the git_tree.  You don't
Packit Service 20376f
 * have to free it, but you must not use it after the git_tree is released.
Packit Service 20376f
 *
Packit Service 20376f
 * Warning: this must examine every entry in the tree, so it is not fast.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree a previously loaded tree.
Packit Service 20376f
 * @param id the sha being looked for
Packit Service 20376f
 * @return the tree entry; NULL if not found
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byid(
Packit Service 20376f
	const git_tree *tree, const git_oid *id);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Retrieve a tree entry contained in a tree or in any of its subtrees,
Packit Service 20376f
 * given its relative path.
Packit Service 20376f
 *
Packit Service 20376f
 * Unlike the other lookup functions, the returned tree entry is owned by
Packit Service 20376f
 * the user and must be freed explicitly with `git_tree_entry_free()`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer where to store the tree entry
Packit Service 20376f
 * @param root Previously loaded tree which is the root of the relative path
Packit Service 20376f
 * @param path Path to the contained entry
Packit Service 20376f
 * @return 0 on success; GIT_ENOTFOUND if the path does not exist
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_entry_bypath(
Packit Service 20376f
	git_tree_entry **out,
Packit Service 20376f
	const git_tree *root,
Packit Service 20376f
	const char *path);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Duplicate a tree entry
Packit Service 20376f
 *
Packit Service 20376f
 * Create a copy of a tree entry. The returned copy is owned by the user,
Packit Service 20376f
 * and must be freed explicitly with `git_tree_entry_free()`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param dest pointer where to store the copy
Packit Service 20376f
 * @param source tree entry to duplicate
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_entry_dup(git_tree_entry **dest, const git_tree_entry *source);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Free a user-owned tree entry
Packit Service 20376f
 *
Packit Service 20376f
 * IMPORTANT: This function is only needed for tree entries owned by the
Packit Service 20376f
 * user, such as the ones returned by `git_tree_entry_dup()` or
Packit Service 20376f
 * `git_tree_entry_bypath()`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry The entry to free
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_tree_entry_free(git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the filename of a tree entry
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return the name of the file
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_tree_entry_name(const git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the id of the object pointed by the entry
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return the oid of the object
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the type of the object pointed by the entry
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return the type of the pointed object
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the UNIX file attributes of a tree entry
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return filemode as an integer
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(git_filemode_t) git_tree_entry_filemode(const git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the raw UNIX file attributes of a tree entry
Packit Service 20376f
 *
Packit Service 20376f
 * This function does not perform any normalization and is only useful
Packit Service 20376f
 * if you need to be able to recreate the original tree object.
Packit Service 20376f
 *
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return filemode as an integer
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
GIT_EXTERN(git_filemode_t) git_tree_entry_filemode_raw(const git_tree_entry *entry);
Packit Service 20376f
/**
Packit Service 20376f
 * Compare two tree entries
Packit Service 20376f
 *
Packit Service 20376f
 * @param e1 first tree entry
Packit Service 20376f
 * @param e2 second tree entry
Packit Service 20376f
 * @return <0 if e1 is before e2, 0 if e1 == e2, >0 if e1 is after e2
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_entry_cmp(const git_tree_entry *e1, const git_tree_entry *e2);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Convert a tree entry to the git_object it points to.
Packit Service 20376f
 *
Packit Service 20376f
 * You must call `git_object_free()` on the object when you are done with it.
Packit Service 20376f
 *
Packit Service 20376f
 * @param object_out pointer to the converted object
Packit Service 20376f
 * @param repo repository where to lookup the pointed object
Packit Service 20376f
 * @param entry a tree entry
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_entry_to_object(
Packit Service 20376f
	git_object **object_out,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const git_tree_entry *entry);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a new tree builder.
Packit Service 20376f
 *
Packit Service 20376f
 * The tree builder can be used to create or modify trees in memory and
Packit Service 20376f
 * write them as tree objects to the database.
Packit Service 20376f
 *
Packit Service 20376f
 * If the `source` parameter is not NULL, the tree builder will be
Packit Service 20376f
 * initialized with the entries of the given tree.
Packit Service 20376f
 *
Packit Service 20376f
 * If the `source` parameter is NULL, the tree builder will start with no
Packit Service 20376f
 * entries and will have to be filled manually.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer where to store the tree builder
Packit Service 20376f
 * @param repo Repository in which to store the object
Packit Service 20376f
 * @param source Source tree to initialize the builder (optional)
Packit Service 20376f
 * @return 0 on success; error code otherwise
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_treebuilder_new(
Packit Service 20376f
	git_treebuilder **out, git_repository *repo, const git_tree *source);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Clear all the entires in the builder
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld Builder to clear
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the number of entries listed in a treebuilder
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld a previously loaded treebuilder.
Packit Service 20376f
 * @return the number of entries in the treebuilder
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(unsigned int) git_treebuilder_entrycount(git_treebuilder *bld);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Free a tree builder
Packit Service 20376f
 *
Packit Service 20376f
 * This will clear all the entries and free to builder.
Packit Service 20376f
 * Failing to free the builder after you're done using it
Packit Service 20376f
 * will result in a memory leak
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld Builder to free
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_treebuilder_free(git_treebuilder *bld);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get an entry from the builder from its filename
Packit Service 20376f
 *
Packit Service 20376f
 * The returned entry is owned by the builder and should
Packit Service 20376f
 * not be freed manually.
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld Tree builder
Packit Service 20376f
 * @param filename Name of the entry
Packit Service 20376f
 * @return pointer to the entry; NULL if not found
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(
Packit Service 20376f
	git_treebuilder *bld, const char *filename);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Add or update an entry to the builder
Packit Service 20376f
 *
Packit Service 20376f
 * Insert a new entry for `filename` in the builder with the
Packit Service 20376f
 * given attributes.
Packit Service 20376f
 *
Packit Service 20376f
 * If an entry named `filename` already exists, its attributes
Packit Service 20376f
 * will be updated with the given ones.
Packit Service 20376f
 *
Packit Service 20376f
 * The optional pointer `out` can be used to retrieve a pointer to the
Packit Service 20376f
 * newly created/updated entry.  Pass NULL if you do not need it. The
Packit Service 20376f
 * pointer may not be valid past the next operation in this
Packit Service 20376f
 * builder. Duplicate the entry if you want to keep it.
Packit Service 20376f
 *
Packit Service 20376f
 * No attempt is being made to ensure that the provided oid points
Packit Service 20376f
 * to an existing git object in the object database, nor that the
Packit Service 20376f
 * attributes make sense regarding the type of the pointed at object.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer to store the entry (optional)
Packit Service 20376f
 * @param bld Tree builder
Packit Service 20376f
 * @param filename Filename of the entry
Packit Service 20376f
 * @param id SHA1 oid of the entry
Packit Service 20376f
 * @param filemode Folder attributes of the entry. This parameter must
Packit Service 20376f
 *			be valued with one of the following entries: 0040000, 0100644,
Packit Service 20376f
 *			0100755, 0120000 or 0160000.
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_treebuilder_insert(
Packit Service 20376f
	const git_tree_entry **out,
Packit Service 20376f
	git_treebuilder *bld,
Packit Service 20376f
	const char *filename,
Packit Service 20376f
	const git_oid *id,
Packit Service 20376f
	git_filemode_t filemode);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Remove an entry from the builder by its filename
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld Tree builder
Packit Service 20376f
 * @param filename Filename of the entry to remove
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_treebuilder_remove(
Packit Service 20376f
	git_treebuilder *bld, const char *filename);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Callback for git_treebuilder_filter
Packit Service 20376f
 *
Packit Service 20376f
 * The return value is treated as a boolean, with zero indicating that the
Packit Service 20376f
 * entry should be left alone and any non-zero value meaning that the
Packit Service 20376f
 * entry should be removed from the treebuilder list (i.e. filtered out).
Packit Service 20376f
 */
Packit Service 20376f
typedef int (*git_treebuilder_filter_cb)(
Packit Service 20376f
	const git_tree_entry *entry, void *payload);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Selectively remove entries in the tree
Packit Service 20376f
 *
Packit Service 20376f
 * The `filter` callback will be called for each entry in the tree with a
Packit Service 20376f
 * pointer to the entry and the provided `payload`; if the callback returns
Packit Service 20376f
 * non-zero, the entry will be filtered (removed from the builder).
Packit Service 20376f
 *
Packit Service 20376f
 * @param bld Tree builder
Packit Service 20376f
 * @param filter Callback to filter entries
Packit Service 20376f
 * @param payload Extra data to pass to filter callback
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_treebuilder_filter(
Packit Service 20376f
	git_treebuilder *bld,
Packit Service 20376f
	git_treebuilder_filter_cb filter,
Packit Service 20376f
	void *payload);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Write the contents of the tree builder as a tree object
Packit Service 20376f
 *
Packit Service 20376f
 * The tree builder will be written to the given `repo`, and its
Packit Service 20376f
 * identifying SHA1 hash will be stored in the `id` pointer.
Packit Service 20376f
 *
Packit Service 20376f
 * @param id Pointer to store the OID of the newly written tree
Packit Service 20376f
 * @param bld Tree builder to write
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_treebuilder_write(
Packit Service 20376f
	git_oid *id, git_treebuilder *bld);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Write the contents of the tree builder as a tree object
Packit Service 20376f
 * using a shared git_buf.
Packit Service 20376f
 *
Packit Service 20376f
 * @see git_treebuilder_write
Packit Service 20376f
 *
Packit Service 20376f
 * @param oid Pointer to store the OID of the newly written tree
Packit Service 20376f
 * @param bld Tree builder to write
Packit Service 20376f
 * @param tree Shared buffer for writing the tree. Will be grown as necessary.
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_treebuilder_write_with_buffer(
Packit Service 20376f
	git_oid *oid, git_treebuilder *bld, git_buf *tree);
Packit Service 20376f
Packit Service 20376f
/** Callback for the tree traversal method */
Packit Service 20376f
typedef int (*git_treewalk_cb)(
Packit Service 20376f
	const char *root, const git_tree_entry *entry, void *payload);
Packit Service 20376f
Packit Service 20376f
/** Tree traversal modes */
Packit Service 20376f
typedef enum {
Packit Service 20376f
	GIT_TREEWALK_PRE = 0, /* Pre-order */
Packit Service 20376f
	GIT_TREEWALK_POST = 1, /* Post-order */
Packit Service 20376f
} git_treewalk_mode;
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Traverse the entries in a tree and its subtrees in post or pre order.
Packit Service 20376f
 *
Packit Service 20376f
 * The entries will be traversed in the specified order, children subtrees
Packit Service 20376f
 * will be automatically loaded as required, and the `callback` will be
Packit Service 20376f
 * called once per entry with the current (relative) root for the entry and
Packit Service 20376f
 * the entry data itself.
Packit Service 20376f
 *
Packit Service 20376f
 * If the callback returns a positive value, the passed entry will be
Packit Service 20376f
 * skipped on the traversal (in pre mode). A negative value stops the walk.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree The tree to walk
Packit Service 20376f
 * @param mode Traversal mode (pre or post-order)
Packit Service 20376f
 * @param callback Function to call on each tree entry
Packit Service 20376f
 * @param payload Opaque pointer to be passed on each callback
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_walk(
Packit Service 20376f
	const git_tree *tree,
Packit Service 20376f
	git_treewalk_mode mode,
Packit Service 20376f
	git_treewalk_cb callback,
Packit Service 20376f
	void *payload);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create an in-memory copy of a tree. The copy must be explicitly
Packit Service 20376f
 * free'd or it will leak.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer to store the copy of the tree
Packit Service 20376f
 * @param source Original tree to copy
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_dup(git_tree **out, git_tree *source);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * The kind of update to perform
Packit Service 20376f
 */
Packit Service 20376f
typedef enum {
Packit Service 20376f
	/** Update or insert an entry at the specified path */
Packit Service 20376f
	GIT_TREE_UPDATE_UPSERT,
Packit Service 20376f
	/** Remove an entry from the specified path */
Packit Service 20376f
	GIT_TREE_UPDATE_REMOVE,
Packit Service 20376f
} git_tree_update_t;
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * An action to perform during the update of a tree
Packit Service 20376f
 */
Packit Service 20376f
typedef struct {
Packit Service 20376f
	/** Update action. If it's an removal, only the path is looked at */
Packit Service 20376f
	git_tree_update_t action;
Packit Service 20376f
	/** The entry's id */
Packit Service 20376f
	git_oid id;
Packit Service 20376f
	/** The filemode/kind of object */
Packit Service 20376f
	git_filemode_t filemode;
Packit Service 20376f
	/** The full path from the root tree */
Packit Service 20376f
	const char *path;
Packit Service 20376f
} git_tree_update;
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a tree based on another one with the specified modifications
Packit Service 20376f
 *
Packit Service 20376f
 * Given the `baseline` perform the changes described in the list of
Packit Service 20376f
 * `updates` and create a new tree.
Packit Service 20376f
 *
Packit Service 20376f
 * This function is optimized for common file/directory addition, removal and
Packit Service 20376f
 * replacement in trees. It is much more efficient than reading the tree into a
Packit Service 20376f
 * `git_index` and modifying that, but in exchange it is not as flexible.
Packit Service 20376f
 *
Packit Service 20376f
 * Deleting and adding the same entry is undefined behaviour, changing
Packit Service 20376f
 * a tree to a blob or viceversa is not supported.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out id of the new tree
Packit Service 20376f
 * @param repo the repository in which to create the tree, must be the
Packit Service 20376f
 * same as for `baseline`
Packit Service 20376f
 * @param baseline the tree to base these changes on
Packit Service 20376f
 * @param nupdates the number of elements in the update list
Packit Service 20376f
 * @param updates the list of updates to perform
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseline, size_t nupdates, const git_tree_update *updates);
Packit Service 20376f
Packit Service 20376f
/** @} */
Packit Service 20376f
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
#endif