git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Christian Couder <christian.couder@gmail.com>,
	Git mailing list <git@vger.kernel.org>
Subject: Re: git commit file completion recently broke
Date: Wed, 6 Dec 2017 16:38:29 -0800	[thread overview]
Message-ID: <CA+P7+xpoaa5zaF13ageKKjpPKTECU6XjaRdSZy6WOP7Q0TX+yA@mail.gmail.com> (raw)
In-Reply-To: <20171207002439.GB21003@sigill.intra.peff.net>

On Wed, Dec 6, 2017 at 4:24 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Dec 06, 2017 at 07:22:35PM -0500, Jeff King wrote:
>
>> On Wed, Dec 06, 2017 at 04:01:51PM -0800, Jacob Keller wrote:
>>
>> > I think I narrowed this down to "git diff-index --name-only --relative
>> > HEAD" producing a list of files *not* relative to the current
>> > directory.
>>
>> Hmm, my guess would have been something funny in the setup code
>> forgetting our original prefix.
>>
>> But nope, it looks like the culprit is f7923a5ece (diff: use
>> skip_to_optional_val(), 2017-12-04), which switched over parsing of
>> "--relative".
>
> Oh, actually, I guess I was half-right. It feeds &options->prefix as the
> "default", meaning that we overwrite it with the empty string. I don't
> think "--relative" works for the semantics of skip_to_optional_value,
> since it needs:
>
>   --relative=foo: set prefix to "foo"
>
>   --relative: leave prefix untouched
>
> -Peff

Yep, and apparently our test suite completely lacked any tests of
--relative on its own.

I've sent a patch to add some tests.

I don't know the exact best way to fix this, I guess we could just
revert it the changes to relative... but maybe we could add or modify
the semantics of skip_to_optional_val()?? What if it was changed so
that it left the value alone if no value was provided? This would
require callers to pre-set the value they want as default, but that
would solve relative's problem.

I'll look into that.

Thanks,
Jake

  reply	other threads:[~2017-12-07  0:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 23:53 git commit file completion recently broke Jacob Keller
2017-12-07  0:01 ` Jacob Keller
2017-12-07  0:08   ` Jacob Keller
2017-12-07  0:22   ` Jeff King
2017-12-07  0:24     ` Jeff King
2017-12-07  0:38       ` Jacob Keller [this message]
2017-12-07  0:56         ` Jeff King
2017-12-07  1:04           ` Jacob Keller
2017-12-07  1:08             ` Jeff King
2017-12-07  8:14           ` Christian Couder
2017-12-07  8:19             ` Jeff King
2017-12-07 15:24             ` Junio C Hamano
2017-12-07 18:57               ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+P7+xpoaa5zaF13ageKKjpPKTECU6XjaRdSZy6WOP7Q0TX+yA@mail.gmail.com \
    --to=jacob.keller@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).