From 4e55ed32db81d06a4f618e2cc0f9da0e223ae304 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Tue, 31 May 2016 17:08:18 -0500 Subject: add: add --chmod=+x / --chmod=-x options The executable bit will not be detected (and therefore will not be set) for paths in a repository with `core.filemode` set to false, though the users may still wish to add files as executable for compatibility with other users who _do_ have `core.filemode` functionality. For example, Windows users adding shell scripts may wish to add them as executable for compatibility with users on non-Windows. Although this can be done with a plumbing command (`git update-index --add --chmod=+x foo`), teaching the `git-add` command allows users to set a file executable with a command that they're already familiar with. Signed-off-by: Edward Thomson Helped-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- cache.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cache.h') diff --git a/cache.h b/cache.h index 6049f86711..c73becbf2d 100644 --- a/cache.h +++ b/cache.h @@ -367,8 +367,8 @@ extern void free_name_hash(struct index_state *istate); #define rename_cache_entry_at(pos, new_name) rename_index_entry_at(&the_index, (pos), (new_name)) #define remove_cache_entry_at(pos) remove_index_entry_at(&the_index, (pos)) #define remove_file_from_cache(path) remove_file_from_index(&the_index, (path)) -#define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags)) -#define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags)) +#define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags), 0) +#define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags), 0) #define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL, NULL) #define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options)) #define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options)) @@ -581,8 +581,8 @@ extern int remove_file_from_index(struct index_state *, const char *path); #define ADD_CACHE_IGNORE_ERRORS 4 #define ADD_CACHE_IGNORE_REMOVAL 8 #define ADD_CACHE_INTENT 16 -extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags); -extern int add_file_to_index(struct index_state *, const char *path, int flags); +extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags, int force_mode); +extern int add_file_to_index(struct index_state *, const char *path, int flags, int force_mode); extern struct cache_entry *make_cache_entry(unsigned int mode, const unsigned char *sha1, const char *path, int stage, unsigned int refresh_options); extern int ce_same_name(const struct cache_entry *a, const struct cache_entry *b); extern void set_object_name_for_intent_to_add_entry(struct cache_entry *ce); @@ -1772,7 +1772,7 @@ void packet_trace_identity(const char *prog); * return 0 if success, 1 - if addition of a file failed and * ADD_FILES_IGNORE_ERRORS was specified in flags */ -int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int flags); +int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int flags, int force_mode); /* diff.c */ extern int diff_auto_refresh_index; -- cgit v1.2.3