git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Petr Baudis <pasky@suse.cz>,
	git@vger.kernel.org, martin f krafft <madduck@debian.org>,
	u.kleine-koenig@pengutronix.de
Subject: Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree  directory
Date: Tue, 17 Mar 2009 00:25:38 +0100	[thread overview]
Message-ID: <36ca99e90903161625x317556f4hc826aabd01494ca0@mail.gmail.com> (raw)
In-Reply-To: <7vbps1umg9.fsf@gitster.siamese.dyndns.org>

On Mon, Mar 16, 2009 at 23:33, Junio C Hamano <gitster@pobox.com> wrote:
> Bert Wesarg <bert.wesarg@googlemail.com> writes:
>
>> tg patch won't work in a sub directory of the working tree, because 'git diff
>> --name-only' prints the names relative to the top working tree.
>
> "diff --relative --name-only"?
No, unfortunately. In my bug case the changed file was in another
subtree, and --relative restricts the output to only files under the
current subtree.

>
>> This is only a quick fix which prefixes all file names with 'git rev-parse
>> --show-cdup'. The right solution would be to cd into the top working tree
>> somewhere in tg.sh.
>>
>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>>
>> ---
>>  tg-patch.sh |    7 ++++++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/tg-patch.sh b/tg-patch.sh
>> index d701c54..e33bab2 100644
>> --- a/tg-patch.sh
>> +++ b/tg-patch.sh
>> @@ -50,13 +50,18 @@ cat_file "$topic:.topmsg"
>>  echo
>>  [ -n "$(git grep $diff_opts '^[-]--' ${diff_committed_only:+"$name"} -- ".topmsg")" ] || echo '---'
>>
>> +# if we are in a sub working tree dir, we need to prefix all file names from
>> +# git diff --name-only with this cdup
>> +cdup=$(git rev-parse --show-cdup)
>> ...
>> +     sed -e "s#^#$cdup#" "$git_is_stupid" |
>
> Do TopGit folks care about special characters in pathnames?
Do 'git rev-parse --show-cdup' return anything other than slashes and dots?

Bert

  reply	other threads:[~2009-03-16 23:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 22:08 [TopGit PATCH] tg-patch: fix invocation in sub working tree directory Bert Wesarg
2009-03-16 22:33 ` Junio C Hamano
2009-03-16 23:25   ` Bert Wesarg [this message]
2009-03-17  0:24     ` Junio C Hamano
2009-03-17  8:02 ` Uwe Kleine-König
2009-03-17  8:33 ` Uwe Kleine-König

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=36ca99e90903161625x317556f4hc826aabd01494ca0@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madduck@debian.org \
    --cc=pasky@suse.cz \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.
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 NNTP newsgroup(s).