From: Erik Faye-Lund Date: Thu, 28 Jul 2011 07:38:05 GMT Subject: Re: [RFC/PATCH] commit: allow partial commits with relative paths Message-ID: In-Reply-To: On Wed, Jul 27, 2011 at 12:19 PM, John Szakmeister wrote: > On Wed, Jul 27, 2011 at 5:53 AM, Michael J Gruber > wrote: > [snip] >> I can't reproduce that name truncation with a current git, btw. (So I >> won't bother bisecting where we removed a spurious offset by "prefix".) > > I can: > > :: git --version > git version 1.7.6.347.g4db0d > :: git init reproduce-bug > Initialized empty Git repository in /Users/jszakmeister/tmp/reproduce-bug/.git/ > :: cd reproduce-bug > :: echo foo > foo.txt > :: mkdir bar > :: echo bar bar/bar.txt > bar bar/bar.txt > :: git add . > :: git commit -m '.' > [master (root-commit) a5f76f1] . >  2 files changed, 2 insertions(+), 0 deletions(-) >  create mode 100644 bar/bar.txt >  create mode 100644 foo.txt > :: cd bar > :: git rm ../foo.txt > rm 'foo.txt' > :: git commit ../foo.txt > error: pathspec 'txt' did not match any file(s) known to git. What seems to happen here, is report_path_error gets called with a pathspec that doesn't contain the prefix (which is "bar/"), yet it tries to skip prefix_len characters ahead in it when reporting. Why the pathspec isn't prefixed by "bar/" is because of the normalize_path_copy-call in prefix_path, when called through get_pathspec("bar/", {"../foo.txt", NULL}).