* "cg-commit -M msg-file ..." fails when not run from top of tree
@ 2006-08-23 10:27 Jim Meyering
2006-08-25 0:06 ` [PATCH] cg-commit: prefix the relative path to the message file Jonas Fonseca
0 siblings, 1 reply; 3+ messages in thread
From: Jim Meyering @ 2006-08-23 10:27 UTC (permalink / raw)
To: git
Hello,
I discovered that "cg-commit -M MSG-FILE ..." fails when run from
a subdirectory, and when MSG-FILE is a relative file name.
This is using cogito-0.17.3-2 from Debian/unstable, but the problem
remains when using the latest cogito sources, pulled minutes ago.
Here's an example:
$ mkdir a; touch a/x; cg-init -m. .; cd a; echo . > x; cg-commit -M x x
defaulting to local storage area
Adding file a/x
Committing initial tree 341d89829a1bf9c0ccfbccf738815cbc862b3242
Committed as 6497164c6f8e86220ff26c6b89b9d0dbad5a7743
cat: x: No such file or directory
[Exit 1]
This appears to be due to the "cd", that can happen in cg-Xlib:
_git="${GIT_DIR:-.git}"
if [ ! "$_git_repo_unneeded" ] && [ ! "$GIT_DIR" ] && [ ! -d "$_git" ]; then
_git_abs_path="$(git-rev-parse --git-dir 2>/dev/null)"
if [ -d "$_git_abs_path" ]; then
_git_relpath="$(git-rev-parse --show-prefix)"
==========> cd "$_git_abs_path/.." <==============
fi
fi
_git_objects="${GIT_OBJECT_DIRECTORY:-$_git/objects}"
I can work around the problem by using an absolute name for
the message file, but I shouldn't have to do that.
FWIW, I tried setting GIT_DIR to the absolute name of the .git directory,
but that just made it so cg-commit failed with this diagnostic:
cg-commit: Nothing to commit
Jim
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] cg-commit: prefix the relative path to the message file
2006-08-23 10:27 "cg-commit -M msg-file ..." fails when not run from top of tree Jim Meyering
@ 2006-08-25 0:06 ` Jonas Fonseca
2006-09-16 15:07 ` Jim Meyering
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Fonseca @ 2006-08-25 0:06 UTC (permalink / raw)
To: Jim Meyering; +Cc: git
Makes the -M switch work from a subdirectory.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
Jim Meyering <jim@meyering.net> wrote Wed, Aug 23, 2006:
> Hello,
Hi,
> I discovered that "cg-commit -M MSG-FILE ..." fails when run from
> a subdirectory, and when MSG-FILE is a relative file name.
> This is using cogito-0.17.3-2 from Debian/unstable, but the problem
> remains when using the latest cogito sources, pulled minutes ago.
The attached patch should fix this problem.
---
cg-commit | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cg-commit b/cg-commit
index 0cec58f..5cebd81 100755
--- a/cg-commit
+++ b/cg-commit
@@ -398,7 +398,7 @@ fi
if [ "$msgfile" ]; then
[ "$written" ] && echo >>"$LOGMSG"
- cat "$msgfile" >>"$LOGMSG" || exit 1
+ cat "$_git_relpath$msgfile" >>"$LOGMSG" || exit 1
written=1
fi
--
Jonas Fonseca
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cg-commit: prefix the relative path to the message file
2006-08-25 0:06 ` [PATCH] cg-commit: prefix the relative path to the message file Jonas Fonseca
@ 2006-09-16 15:07 ` Jim Meyering
0 siblings, 0 replies; 3+ messages in thread
From: Jim Meyering @ 2006-09-16 15:07 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: git
Jonas Fonseca <fonseca@diku.dk> wrote:
> Makes the -M switch work from a subdirectory.
>
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
>
> ---
>
> Jim Meyering <jim@meyering.net> wrote Wed, Aug 23, 2006:
>> Hello,
>
> Hi,
>
>> I discovered that "cg-commit -M MSG-FILE ..." fails when run from
>> a subdirectory, and when MSG-FILE is a relative file name.
>> This is using cogito-0.17.3-2 from Debian/unstable, but the problem
>> remains when using the latest cogito sources, pulled minutes ago.
>
> The attached patch should fix this problem.
>
> ---
>
> cg-commit | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/cg-commit b/cg-commit
> index 0cec58f..5cebd81 100755
> --- a/cg-commit
> +++ b/cg-commit
> @@ -398,7 +398,7 @@ fi
>
> if [ "$msgfile" ]; then
> [ "$written" ] && echo >>"$LOGMSG"
> - cat "$msgfile" >>"$LOGMSG" || exit 1
> + cat "$_git_relpath$msgfile" >>"$LOGMSG" || exit 1
> written=1
> fi
>
>
Thank you!
That solved the problem for me.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-16 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 10:27 "cg-commit -M msg-file ..." fails when not run from top of tree Jim Meyering
2006-08-25 0:06 ` [PATCH] cg-commit: prefix the relative path to the message file Jonas Fonseca
2006-09-16 15:07 ` Jim Meyering
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).