"Ping Yin" <pkufranky@xxxxxxxxx> writes: >> > >> > I think you would want to read full 40-char sha1_src and >> > sha1_dst with "while read", and keep that full 40-char in these >> > variables, and use them when calling rev-parse here. >> >> Hmm, precision is really a problem. However, "git diff --raw" will not >> always give full 40-char sha1, instead it will give sha1 with enough >> length. So maybe i can use the sha1 from "git diff --raw" ? >> > Oh, I'm wrong. It seems 'git diff --raw' will always give full 40-char > sha1 for submodule entry and abbreviated sha1 for blob entry. It is not recommended to use "git diff" in scripts when you can use one of the "git diff-*" plumbing. In this case I think you would want "git-diff-index". Also see --abbrev option. You can never determine how many hexdigits are "enough" from the containing project, as it does not have to have access to the submodule object store. That's the reason I suggested to read full object name from diff-index and use it for error reporting and object retrieval, and shorten it in the UI for normal status noise. - 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