Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > + /* > + * If it has the same content that we are going to write down, write down??? > + * there's no point in complaining. We still overwrite it in the > + * end though. Permission is not checked so it may be lost. > + */ That is a regression, isn't it? Is it too cumbersome to avoid losing the permission bits by stopping in that case? > + if (ce && > + S_ISREG(st->st_mode) && S_ISREG(ce->ce_mode) && > + st->st_size < 1024 * 1024 && /* should be configurable */ > + sha1_object_info(ce->sha1, &ce_size) == OBJ_BLOB && > + ce_size == st->st_size) { > + void *buffer = NULL; > + unsigned long size; > + enum object_type type; > + struct strbuf sb = STRBUF_INIT; > + int matched = > + strbuf_read_file(&sb, ce->name, ce_size) == ce_size && > + (buffer = read_sha1_file(ce->sha1, &type, &size)) != NULL && > + type == OBJ_BLOB && > + size == ce_size && > + !memcmp(buffer, sb.buf, size); > + free(buffer); > + strbuf_release(&sb); > + if (matched) > + return 0; > + } > + > return o->gently ? -1 : > add_rejected_path(o, error_type, name); > } -- 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