Re: [RFC/PATCH] commit: allow partial commits with relative paths
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Jul 28, 2011, 07:38 UTC
- Message-ID
- <CABPQNSb_k8Ye1zaD6rJcfXPT1_pOU9NBG_Z7pFDgNqtUyL4GUQ@mail.gmail.com>
- In-Reply-To
- <CAEBDL5XJbYT9yczZiVPpeA3mpROuKQdw+-AOJjUmRp4W6M5uzg@mail.gmail.com>
On Wed, Jul 27, 2011 at 12:19 PM, John Szakmeister <john@szakmeister.net> wrote:
Show 28 quoted lines
> On Wed, Jul 27, 2011 at 5:53 AM, Michael J Gruber > <git@drmicha.warpmail.net> 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}).