git/builtin
Junio C Hamano 6a2abdc125 apply: compute patch->def_name correctly under -p0
Back when "git apply" was written, we made sure that the user can
skip more than the default number of path components (i.e. 1) by
giving "-p<n>", but the logic for doing so was built around the
notion of "we skip N slashes and stop".  This obviously does not
work well when running under -p0 where we do not want to skip any,
but still want to skip SP/HT that separates the pathnames of
preimage and postimage and want to reject absolute pathnames.

Stop using "stop_at_slash()", and instead introduce a new helper
"skip_tree_prefix()" with similar logic but works correctly even for
the -p0 case.

This is an ancient bug, but has been masked for a long time because
most of the patches are text and have other clues to tell us the
name of the preimage and the postimage.

Noticed by Colin McCabe.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-24 23:11:05 -07:00
..
2011-12-13 21:58:51 -08:00
2011-06-20 14:27:36 -07:00
2012-01-06 12:44:07 -08:00
2012-01-06 12:44:07 -08:00
2011-12-13 10:17:50 -08:00
2011-11-07 22:12:19 -08:00
2011-12-21 12:02:44 -08:00
2010-11-24 15:55:19 -08:00
2011-03-22 10:16:54 -07:00
2011-03-22 10:16:54 -07:00
2012-01-06 12:44:07 -08:00
2011-12-28 11:32:36 -08:00
2011-12-22 11:27:26 -08:00
2012-01-12 23:33:39 -08:00
2011-03-22 10:16:54 -07:00
2011-03-22 10:16:54 -07:00
2011-11-07 22:12:19 -08:00
2011-03-22 11:43:27 -07:00
2011-03-22 10:16:54 -07:00
2011-09-01 15:46:13 -07:00
2011-12-22 15:30:22 -08:00
2011-03-09 23:52:56 -08:00
2011-05-31 12:19:11 -07:00
2011-12-13 23:07:47 -08:00
2011-03-22 10:16:54 -07:00
2011-08-25 14:42:11 -07:00
2010-11-15 10:04:43 -08:00
2011-03-22 10:16:54 -07:00