aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-25 16:00:24 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-25 16:00:24 -0700
commit22f65789753e2ee874b28a38410bc64d6099e895 (patch)
treeb8bbb62dbd1ecfe9136df3ee643df3e8f040d326 /builtin
parente11fa9a460b51947c3ef28be84346a1e90d027ca (diff)
parentbb571486ae93d02746c4bcc8032bde306f6d399a (diff)
downloadgit-22f65789753e2ee874b28a38410bc64d6099e895.tar.gz
git-22f65789753e2ee874b28a38410bc64d6099e895.tar.xz
Merge branch 'ac/describe-dirty-refresh'
* ac/describe-dirty-refresh: describe: Refresh the index when run with --dirty
Diffstat (limited to 'builtin')
-rw-r--r--builtin/describe.c17
1 files changed, 15 insertions, 2 deletions
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"));