Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions include/git2/gitup_index.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "common.h"
#include "indexer.h"
#include "types.h"
#include "oid.h"
#include "strarray.h"

/**
* @file git2/index.h
* @brief Index (aka "cache" aka "staging area")
* @defgroup git_index Git index parsing and manipulation routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL

/**
* Forget the file associated with this index.
*
* This will prevent using operations that read
* or write to the index's on-disk file.
* This (probably) effectively makes this index
* indistinguishable from an in-memory index.
*
* @param index An index object
*/
GIT_EXTERN(void) git_index_forget_file(git_index *index);

/** @} */
GIT_END_DECL
6 changes: 6 additions & 0 deletions src/libgit2/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -3938,6 +3938,12 @@ void git_indexwriter_cleanup(git_indexwriter *writer)
writer->index = NULL;
}

void git_index_forget_file(git_index *index)
{
index->index_file_path = NULL;
index->on_disk = 0;
}

/* Deprecated functions */

#ifndef GIT_DEPRECATE_HARD
Expand Down
Loading