Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > Even if it is easier to write HEAD~2000, it is legal to write > HEAD^^^... (repeats "^" 2000 times in total). However, such a string is > too long to be a legal filename (and on Windows, by default even much, > much shorter strings are still illegal because they exceed MAX_PATH). > > Therefore, if the check_filename() function encounters too long a > command-line parameter, it should interpet the error code ENAMETOOLONG > as a strong hint that this is not a file name instead of dying with an > error message. > > Noticed-by: Ole Tange <ole@xxxxxxxx> > Helped-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- While I think it is a good thing to try solving, i.e. it would be nicer to the user if "git foo HEAD^^^^..." can be spelled without needing a "--" disambiguation, I am not sure this patch solves it at the right level. The log message is unclear if the patch author even thought about ramifications of the callers not involved in the case written in it. For example, verify_filename() calls this function, saying "This string must name a file and otherwise I want you to die". There is a direct call to check_filename() in builtin/checkout.c; it is unclear how it would interact with this change, either. -- 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