We cannot currently say: $ commit-tree $(write-tree) $(cat .git/heads/junio .git/heads/linus)
The above must be written as: $ commit-tree $(write-tree) \ -p $(cat .git/heads/junio) \ -p $(cat .git/heads/linus) This patch makes -p flag optional. Existing scripts are hopefully not affected because they are passing -p properly. If we want to introduce non parent-ID parameters to commit-tree later, we can give them their own -flag letters. Signed-off-by: Junio C Hamano <[EMAIL PROTECTED]> --- commit-tree.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) commit-tree.c: c0b07f89286c3f6cceae8122b4c3142c8efaf8e1 --- a/commit-tree.c +++ b/commit-tree.c @@ -297,10 +297,17 @@ int main(int argc, char **argv) usage(commit_tree_usage); check_valid(tree_sha1, "tree"); - for (i = 2; i < argc; i += 2) { - char *a, *b; - a = argv[i]; b = argv[i+1]; - if (!b || strcmp(a, "-p") || get_sha1_hex(b, parent_sha1[parents])) + for (i = 2; i < argc; i++) { + /* Historically commit-tree required -p in front of + * each parent commit ID. This is confusing. We can + * add non parent commit ID parameter later by defining + * flags other than "-p" so let's just ignore them. + */ + if (! strcmp(argv[i], "-p")) + continue; + + /* Currently it just expects parent IDs. */ + if (get_sha1_hex(argv[i], parent_sha1[parents])) usage(commit_tree_usage); check_valid(parent_sha1[parents], "commit"); parents++; - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html