diff -u git-core-1.7.0.4/debian/changelog git-core-1.7.0.4/debian/changelog --- git-core-1.7.0.4/debian/changelog +++ git-core-1.7.0.4/debian/changelog @@ -1,3 +1,11 @@ +git-core (1:1.7.0.4-1ubuntu0.3) lucid-proposed; urgency=low + + * debian/diff/0035-describe-Refresh-the-index-when-run-with-dirty.diff: + Backport upstream patch to resolve 'git describe' and stale index + (LP: #1057813) + + -- Paul Belanger Thu, 27 Sep 2012 19:32:56 -0400 + git-core (1:1.7.0.4-1ubuntu0.2) lucid-security; urgency=low * SECURITY UPDATE: gitweb cross-site scripting vulnerability only in patch2: unchanged: --- git-core-1.7.0.4.orig/debian/diff/0035-describe-Refresh-the-index-when-run-with-dirty.diff +++ git-core-1.7.0.4/debian/diff/0035-describe-Refresh-the-index-when-run-with-dirty.diff @@ -0,0 +1,48 @@ +From bb571486ae93d02746c4bcc8032bde306f6d399a Mon Sep 17 00:00:00 2001 +From: Allan Caffee +Date: Sun, 31 Jul 2011 21:52:41 -0400 +Subject: [PATCH] describe: Refresh the index when run with --dirty + +When running git describe --dirty the index should be refreshed. Previously +the cached index would cause describe to think that the index was dirty when, +in reality, it was just stale. + +The issue was exposed by python setuptools which hardlinks files into another +directory when building a distribution. + +Signed-off-by: Junio C Hamano +--- + builtin/describe.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/builtin-describe.c b/builtin-describe.c +index 66fc291..9f63067 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")); +-- +1.7.9.5 +