git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [TopGit PATCH] tg-patch: fix invocation in sub working tree directory

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 16, 2009, 22:33 UTC
Message-ID
<7vbps1umg9.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1237241299-25515-1-git-send-email-bert.wesarg@googlemail.com>
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"?
Show 23 quoted lines
> 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?
Previous: Bert WesargNext: Bert Wesarg
Message 2 of 6 in “tg-patch: fix invocation in sub working tree directory”
  1. tg-patch: fix invocation in sub working tree directoryBert Wesarg, Mar 16, 2009
  2. Junio C HamanoMar 16, 2009
  3. Bert WesargMar 16, 2009
  4. Junio C HamanoMar 17, 2009
  5. Uwe Kleine-KönigMar 17, 2009
  6. Uwe Kleine-KönigMar 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.