2011/9/17 Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>: > This particular SHA-1 has special meaning to git, very much like NULL > in C. If a user adds a file that has this SHA-1, unexpected things can > happen. > > Granted, the chance is probably near zero because the content must > also start with valid blob header. But extra safety does not harm. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > Another way than die() is to detect this situation and update header a > little to give different SHA-1 (for example a leading 0 in object > size in header). Older git versions may not be happy with such an > approach. > > The same check can be added to commit, tree, tag creation and fsck. > Maybe I'm too paranoid. > > By the way, are any other SHA-1s sensitive to git like this one? Bad things will happen if you get an object with the same hash as any already existing one, and AFAIK, there are no checks for this. I don't think there's much point in treating 000...0 more specially than HEAD^0 for example. The only two hashes that mean something in an empty repo I guess are this one and the empty tree hash though. PS there's a typo in your error message, "unluckly". -- Mikael Magnusson -- 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