add: don't write objects with --dry-run
When the option --dry-run/-n is given, "git add" doesn't change the index, but still writes out new object files. Only hash the latter without writing instead to make the run as dry as possible. Use this opportunity to also make the hash_flags variable unsigned, to match the index_path() parameter it is used as. Reported-by: git.mexon@spamgourmet.com Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
225bc32a98
commit
e578d0311d
@ -738,7 +738,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
|
||||
int intent_only = flags & ADD_CACHE_INTENT;
|
||||
int add_option = (ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE|
|
||||
(intent_only ? ADD_CACHE_NEW_ONLY : 0));
|
||||
int hash_flags = HASH_WRITE_OBJECT;
|
||||
unsigned hash_flags = pretend ? 0 : HASH_WRITE_OBJECT;
|
||||
struct object_id oid;
|
||||
|
||||
if (flags & ADD_CACHE_RENORMALIZE)
|
||||
|
Reference in New Issue
Block a user