Re: [PATCH 4/3] t3700: avoid racy git situation

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

 



Johannes Schindelin schrieb:
The problem is that the index has the same timestamp as the file "foo".

Therefore, git cannot tell if "foo" is up-to-date in the index, since it could have been modified (and indeed is) just a fraction of a second later than the index was last updated.

The test goes like this:

        >foo && git add foo && git commit -a -m "commit all" &&
        test -z "`git diff-index HEAD -- foo`" &&
        git read-tree HEAD &&
        case "`git diff-index HEAD -- foo`" in
        :100644" "*"M   foo") echo ok;;
        *) echo fail; (exit 1);;
        esac &&
        git add --refresh -- foo &&
        test -z "`git diff-index HEAD -- foo`"

I'm pretty sure that this test completed within one second even before git-commit was a builtin. (I assume that timestamps don't have sub-second resolution.) Why then didn't this racy-git problem occur with the scripted git-commit?

-- Hannes
-
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]

  Powered by Linux