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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:24

Bert Wesarg [off-list ref] 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"?
quoted hunk
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 <redacted>

---
 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?

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

From: Bert Wesarg <hidden>
Date: 2016-06-15 22:46:24

On Mon, Mar 16, 2009 at 23:33, Junio C Hamano [off-list ref] wrote:
Bert Wesarg [off-list ref] writes:
quoted
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.
quoted
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 <redacted>

---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help