X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fdescribe.c;h=9f63067f50a6f49d61d40474608535905bec905b;hb=701825de23da2bff6c784d33ff27f75e802abd81;hp=66fc291c8a81de71dee7b597c9ab0dc9d70e8e29;hpb=40ffc49876611150104102d59a35d865e4670bd7;p=git.git diff --git a/builtin/describe.c b/builtin/describe.c index 66fc291c8..9f63067f5 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -462,8 +462,21 @@ int cmd_describe(int argc, const char **argv, const char *prefix) die(_("No names found, cannot describe anything.")); if (argc == 0) { - if (dirty && !cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, diff_index_args, prefix)) - dirty = NULL; + if (dirty) { + static struct lock_file index_lock; + int fd; + + read_cache_preload(NULL); + refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, + NULL, NULL, NULL); + fd = hold_locked_index(&index_lock, 0); + if (0 <= fd) + update_index_if_able(&the_index, &index_lock); + + if (!cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, + diff_index_args, prefix)) + dirty = NULL; + } describe("HEAD", 1); } else if (dirty) { die(_("--dirty is incompatible with committishes"));