public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: John Keeping <john@keeping•me.uk>
To: Jonathan Nieder <jrnieder@gmail•com>
Cc: git@vger•kernel.org, Jens Lehmann <Jens.Lehmann@web•de>,
	Heiko Voigt <hvoigt@hvoigt•net>
Subject: Re: [PATCH 1/2] rev-parse: add --filename-prefix option
Date: Mon, 8 Apr 2013 09:31:23 +0100	[thread overview]
Message-ID: <20130408083123.GN2222@serenity.lan> (raw)
In-Reply-To: <20130407221458.GE19857@elie.Belkin>

On Sun, Apr 07, 2013 at 03:14:58PM -0700, Jonathan Nieder wrote:
> John Keeping wrote:
> 
> > This adds a prefix string to any filename arguments encountered after it
> > has been specified.
> 
> I assume this is a way of passing the prefix in?  In that case, I
> think a good UI would be
> 
> 	git rev-parse --prefix=Documentation/ <usual rev-parse args>
> 
> That sounds like a useful thing and would make the meaning very clear.

Yes (ish), the intended usage is something like this:

    prefix=$(git rev-parse --show-prefix)
    cd_to_toplevel
    ... parse options here ...
    # Convert remaining arguments (filenames) into top-level paths:
    eval "set $(git rev-parse --prefix "$prefix" --sq -- "$@")"

The "ish" is that my current implementation introduced a new variable
instead of simply resetting the existing "prefix" variable, which I
assume is what you mean.  That is probably simpler than my
implementation, but loses the ability to be at an intermediate level,
for example:

    cd Documentation/
    eval "set $(git rev-parse --prefix technical/ --sq -- api-strbuf.txt)"

> How does this interact with the following options?
> 
>  * --resolve-git-dir some/relative/path

It doesn't change this since --resolve-git-dir is handled separately
from the other argument parsing at the moment and you cannot specify
any other options with it.

>  * master:./path

I hadn't considered this case, but I think it should be inserting the
prefix into the path.  I suspect the easiest thing to do is simply make
the path part of that absolute, by combining both the prefix based on
$PWD and the prefix specified on the command line, but I haven't looked
at doing this yet.

The other think that's missing at the moment is that the prefix passed
to verify_filename should be modified by the one specified on the
command line.

> As for the patch itself, I haven't looked at it closely.  My only
> immediate reaction is that I wish it touched Documentation/ and t/. :)

I'll make sure the next version does.  This version was doing the
minimum required to make patch 2/2 possible, it certainly needs some
polish before it's more than a proof-of-concept.

  reply	other threads:[~2013-04-08 22:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 19:55 [RFC/PATCH 0/2] submodule: drop the top-level requirement John Keeping
2013-04-07 19:55 ` [PATCH 1/2] rev-parse: add --filename-prefix option John Keeping
2013-04-07 22:14   ` Jonathan Nieder
2013-04-08  8:31     ` John Keeping [this message]
2013-04-08 15:07       ` Junio C Hamano
2013-04-08 17:36         ` John Keeping
2013-04-08 18:11           ` Junio C Hamano
2013-04-07 19:55 ` [PATCH 2/2] submodule: drop the top-level requirement John Keeping
2013-04-07 20:15 ` [RFC/PATCH 0/2] " Jens Lehmann
2013-04-09 20:29 ` [PATCH v2 " John Keeping
2013-04-09 20:29   ` [PATCH v2 1/2] rev-parse: add --filename-prefix option John Keeping
2013-04-09 20:57     ` Junio C Hamano
2013-04-09 21:28       ` John Keeping
2013-04-09 21:33         ` Junio C Hamano
2013-04-18 14:28     ` Ramkumar Ramachandra
2013-04-18 14:42       ` John Keeping
2013-04-09 20:29   ` [PATCH v2 2/2] submodule: drop the top-level requirement John Keeping
2013-04-09 21:00     ` Junio C Hamano
2013-04-09 21:29       ` John Keeping
2013-04-18 14:46     ` Ramkumar Ramachandra
2013-04-18 14:56       ` John Keeping
2013-04-18 19:50   ` [PATCH v3 0/2] " John Keeping
2013-04-18 19:50     ` [PATCH v3 1/2] rev-parse: add --prefix option John Keeping
2013-04-19  9:53       ` Ramkumar Ramachandra
2013-04-19 10:22         ` John Keeping
2013-04-19 11:15           ` Ramkumar Ramachandra
2013-04-19 11:25             ` John Keeping
2013-04-19 11:29               ` Ramkumar Ramachandra
2013-04-18 19:50     ` [PATCH v3 2/2] submodule: drop the top-level requirement John Keeping
2013-04-18 22:40       ` Junio C Hamano
2013-04-19  7:46         ` John Keeping
2013-04-19 16:45           ` Junio C Hamano
2013-04-19 19:23             ` Johannes Sixt
2013-04-19 21:03               ` Junio C Hamano
2013-04-24  8:15                 ` [PATCH] submodule: fix quoting in relative_path() John Keeping
2013-04-24 16:21                   ` Junio C Hamano
2013-04-24 16:28                     ` John Keeping
2013-04-24 19:12                       ` Johannes Sixt
2013-04-18 23:54       ` [PATCH v3 2/2] submodule: drop the top-level requirement Eric Sunshine

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

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

  git send-email \
    --in-reply-to=20130408083123.GN2222@serenity.lan \
    --to=john@keeping$(echo .)me.uk \
    --cc=Jens.Lehmann@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=hvoigt@hvoigt$(echo .)net \
    --cc=jrnieder@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox