Merge branch 'jk/maint-status-keep-index-timestamp'
* jk/maint-status-keep-index-timestamp: do not write out index when status does not have tomaint
commit
bff6e86b3d
|
@ -343,9 +343,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
|
||||||
if (!pathspec || !*pathspec) {
|
if (!pathspec || !*pathspec) {
|
||||||
fd = hold_locked_index(&index_lock, 1);
|
fd = hold_locked_index(&index_lock, 1);
|
||||||
refresh_cache_or_die(refresh_flags);
|
refresh_cache_or_die(refresh_flags);
|
||||||
|
if (active_cache_changed) {
|
||||||
if (write_cache(fd, active_cache, active_nr) ||
|
if (write_cache(fd, active_cache, active_nr) ||
|
||||||
commit_locked_index(&index_lock))
|
commit_locked_index(&index_lock))
|
||||||
die("unable to write new_index file");
|
die("unable to write new_index file");
|
||||||
|
} else {
|
||||||
|
rollback_lock_file(&index_lock);
|
||||||
|
}
|
||||||
commit_style = COMMIT_AS_IS;
|
commit_style = COMMIT_AS_IS;
|
||||||
return get_index_file();
|
return get_index_file();
|
||||||
}
|
}
|
||||||
|
@ -1085,8 +1089,10 @@ int cmd_status(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
fd = hold_locked_index(&index_lock, 0);
|
fd = hold_locked_index(&index_lock, 0);
|
||||||
if (0 <= fd) {
|
if (0 <= fd) {
|
||||||
if (!write_cache(fd, active_cache, active_nr))
|
if (active_cache_changed &&
|
||||||
|
!write_cache(fd, active_cache, active_nr))
|
||||||
commit_locked_index(&index_lock);
|
commit_locked_index(&index_lock);
|
||||||
|
else
|
||||||
rollback_lock_file(&index_lock);
|
rollback_lock_file(&index_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue