git/entry.h
Junio C Hamano f9ba6acaa9 Merge branch 'mc/clean-smudge-with-llp64'
The clean/smudge conversion code path has been prepared to better
work on platforms where ulong is narrower than size_t.

* mc/clean-smudge-with-llp64:
  clean/smudge: allow clean filters to process extremely large files
  odb: guard against data loss checking out a huge file
  git-compat-util: introduce more size_t helpers
  odb: teach read_blob_entry to use size_t
  t1051: introduce a smudge filter test for extremely large files
  test-lib: add prerequisite for 64-bit platforms
  test-tool genzeros: generate large amounts of data more efficiently
  test-genzeros: allow more than 2G zeros in Windows
2021-11-29 15:41:51 -08:00

61 lines
1.9 KiB
C

#ifndef ENTRY_H
#define ENTRY_H
#include "cache.h"
#include "convert.h"
struct checkout {
struct index_state *istate;
const char *base_dir;
int base_dir_len;
struct delayed_checkout *delayed_checkout;
struct checkout_metadata meta;
unsigned force:1,
quiet:1,
not_new:1,
clone:1,
refresh_cache:1;
};
#define CHECKOUT_INIT { .base_dir = "" }
#define TEMPORARY_FILENAME_LENGTH 25
/*
* Write the contents from ce out to the working tree.
*
* When topath[] is not NULL, instead of writing to the working tree
* file named by ce, a temporary file is created by this function and
* its name is returned in topath[], which must be able to hold at
* least TEMPORARY_FILENAME_LENGTH bytes long.
*
* With checkout_entry_ca(), callers can optionally pass a preloaded
* conv_attrs struct (to avoid reloading it), when ce refers to a
* regular file. If ca is NULL, the attributes will be loaded
* internally when (and if) needed.
*/
int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
const struct checkout *state, char *topath,
int *nr_checkouts);
static inline int checkout_entry(struct cache_entry *ce,
const struct checkout *state, char *topath,
int *nr_checkouts)
{
return checkout_entry_ca(ce, NULL, state, topath, nr_checkouts);
}
void enable_delayed_checkout(struct checkout *state);
int finish_delayed_checkout(struct checkout *state, int *nr_checkouts,
int show_progress);
/*
* Unlink the last component and schedule the leading directories for
* removal, such that empty directories get removed.
*/
void unlink_entry(const struct cache_entry *ce);
void *read_blob_entry(const struct cache_entry *ce, size_t *size);
int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st);
void update_ce_after_write(const struct checkout *state, struct cache_entry *ce,
struct stat *st);
#endif /* ENTRY_H */