summaryrefslogtreecommitdiff
path: root/dir.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2015-03-08 17:12:46 +0700
committerJunio C Hamano <gitster@pobox.com>2015-03-12 13:45:18 -0700
commit1e8fef609e78110e276df633c5ba1fb1f1589fa5 (patch)
treec7ccbe9baf7e7b557fbfe77f406198cc5ce20939 /dir.h
parent7b6aff0655c965959a59cc7fa3ed51c2a1fbcd44 (diff)
downloadgit-1e8fef609e78110e276df633c5ba1fb1f1589fa5.tar.gz
untracked cache: guard and disable on system changes
If the user enables untracked cache, then - move worktree to an unsupported filesystem - or simply upgrade OS - or move the whole (portable) disk from one machine to another - or access a shared fs from another machine there's no guarantee that untracked cache can still function properly. Record the worktree location and OS footprint in the cache. If it changes, err on the safe side and disable the cache. The user can 'update-index --untracked-cache' again to make sure all conditions are met. This adds a new requirement that setup_git_directory* must be called before read_cache() because we need worktree location by then, or the cache is dropped. This change does not cover all bases, you can fool it if you try hard. The point is to stop accidents. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Helped-by: brian m. carlson <sandals@crustytoothpaste.net> Helped-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.h')
-rw-r--r--dir.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index 2ce7dd3d27..6ccbc454ac 100644
--- a/dir.h
+++ b/dir.h
@@ -127,6 +127,7 @@ struct untracked_cache {
struct sha1_stat ss_info_exclude;
struct sha1_stat ss_excludes_file;
const char *exclude_per_dir;
+ struct strbuf ident;
/*
* dir_struct#flags must match dir_flags or the untracked
* cache is ignored.
@@ -305,4 +306,5 @@ void untracked_cache_add_to_index(struct index_state *, const char *);
void free_untracked_cache(struct untracked_cache *);
struct untracked_cache *read_untracked_extension(const void *data, unsigned long sz);
void write_untracked_extension(struct strbuf *out, struct untracked_cache *untracked);
+void add_untracked_ident(struct untracked_cache *);
#endif