Re: Unusual behavior from git describe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 30, 2011 at 9:32 AM, Sverre Rabbelier <srabbelier@xxxxxxxxx> wrote:
> Does it perhaps touch some of the tracked files? That way it would
> make sense git at first thinks it's dirty (since the lstat info
> changed), but then 'git status' will actually check the contents of
> the file and notice that they're equal? Just guessing here though.

Sounds like you're on the right track.  git diff-index reveals that
the index is stale

========>8==============>8=========
:100644 100644 781975ec321be574e0b016c9e699804430a4cefc
0000000000000000000000000000000000000000 M	MANIFEST.in
:100644 100644 bddeac47f9d67e8496a7e1d76f3e024e644ee332
0000000000000000000000000000000000000000 M	fabfile.py
...
:100644 100644 4f09e2dbb7b0b7aeb0063468bd1931e5c969d2d6
0000000000000000000000000000000000000000 M	flaskapi/__init__.py
:100644 100644 e4cc0de216a9c5a68ca87650bbe0be24f327df27
0000000000000000000000000000000000000000 M	version.py
===============>8==============>8==

It looks like this was caused by setuptools hardlinking files into a
temp directory and then deleting the links, as demonstrated by:

% git diff-index HEAD --
% ln MANIFEST.in file && rm file
% git diff-index HEAD --
:100644 100644 781975ec321be574e0b016c9e699804430a4cefc
0000000000000000000000000000000000000000 M	MANIFEST.in

I've tried adding a call to refresh_index() in describe.c but it
doesn't seem to have any effect on the results. (Patch below.)  Any
idea what the proper fix is for this?

--
Allan

diff --git a/builtin/describe.c b/builtin/describe.c
index 66fc291..73e98ed 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -462,8 +462,11 @@ 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) {
+                   refresh_index(&the_index,
REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
+                   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"));
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]