* [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
@ 2009-03-16 22:08 Bert Wesarg
2009-03-16 22:33 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bert Wesarg @ 2009-03-16 22:08 UTC (permalink / raw)
To: Petr Baudis; +Cc: Bert Wesarg, git, martin f krafft, u.kleine-koenig
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.
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)
+
# Evil obnoxious hack to work around the lack of git diff --exclude
git_is_stupid="$(mktemp -t tg-patch-changes.XXXXXX)"
git diff --name-only $diff_opts "$base_rev" ${diff_committed_only:+"$name"} -- |
fgrep -vx ".topdeps" |
fgrep -vx ".topmsg" >"$git_is_stupid" || : # fgrep likes to fail randomly?
if [ -s "$git_is_stupid" ]; then
- cat "$git_is_stupid" | xargs git diff --patch-with-stat $diff_opts "$base_rev" ${diff_committed_only:+"$name"} --
+ sed -e "s#^#$cdup#" "$git_is_stupid" |
+ xargs git diff --patch-with-stat $diff_opts "$base_rev" ${diff_committed_only:+"$name"} --
else
echo "No changes."
fi
--
tg: (d145a7b..) bw/fix-tg-patch-in-sub-dir (depends on: master)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
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
2009-03-17 8:02 ` Uwe Kleine-König
2009-03-17 8:33 ` Uwe Kleine-König
2 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2009-03-16 22:33 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft, u.kleine-koenig
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"?
> 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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
2009-03-16 22:33 ` Junio C Hamano
@ 2009-03-16 23:25 ` Bert Wesarg
2009-03-17 0:24 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Bert Wesarg @ 2009-03-16 23:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Petr Baudis, git, martin f krafft, u.kleine-koenig
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
2009-03-16 23:25 ` Bert Wesarg
@ 2009-03-17 0:24 ` Junio C Hamano
0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2009-03-17 0:24 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft, u.kleine-koenig
Bert Wesarg <bert.wesarg@googlemail.com> writes:
> 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.
Ah, Ok, then insertion of cdup output does make sense (after all cdup was
designed to be used that way).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
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-17 8:02 ` Uwe Kleine-König
2009-03-17 8:33 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2009-03-17 8:02 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft
On Mon, Mar 16, 2009 at 11:08:19PM +0100, Bert Wesarg wrote:
> 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.
Hhhm, that's not exactly the problem.
git diff --patch-with-stat 45c82b5 t/trivial/typo-kernel -- $path
expects $path to be relative to the top working tree.
IMHO this is a strange behaviour of core git when comparing two trees
(and not a tree and the wc). Moreover as the output uses "absolute"
paths:
ukleinek@cassiopeia:~/gsrc/linux-2.6/fs$ git diff --patch-with-stat 45c82b5 t/trivial/typo-kernel -- proc/nommu.c | diffstat -p0
b/fs/proc/nommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory
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-17 8:02 ` Uwe Kleine-König
@ 2009-03-17 8:33 ` Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2009-03-17 8:33 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft
Hello again,
On Mon, Mar 16, 2009 at 11:08:19PM +0100, Bert Wesarg wrote:
> --- 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)
> +
> # Evil obnoxious hack to work around the lack of git diff --exclude
> git_is_stupid="$(mktemp -t tg-patch-changes.XXXXXX)"
> git diff --name-only $diff_opts "$base_rev" ${diff_committed_only:+"$name"} -- |
> fgrep -vx ".topdeps" |
> fgrep -vx ".topmsg" >"$git_is_stupid" || : # fgrep likes to fail randomly?
> if [ -s "$git_is_stupid" ]; then
> - cat "$git_is_stupid" | xargs git diff --patch-with-stat $diff_opts "$base_rev" ${diff_committed_only:+"$name"} --
> + sed -e "s#^#$cdup#" "$git_is_stupid" |
> + xargs git diff --patch-with-stat $diff_opts "$base_rev" ${diff_committed_only:+"$name"} --
My not move pretty_tree from tg-export.sh to tg.sh and use that.
i.e.
git diff $someopts "$(pretty_tree "$base_rev")" "$(pretty_tree "...")"
then we wouldn't need that git_is_stupid-hack and the relative path name
thinggy wouldn hurt us.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-17 8:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.