Skip to content

WITH-EDITOR... line doesn't work from a program that changes directory #55

@raeburn

Description

@raeburn

I'm using a remote shell to explore a git checkout tree, run diffs, and do commits. (Yes, I know, should learn magit one of these days. :-) I used with-editor-export-editor to set $EDITOR in the shell process.

If I'm in a subdirectory of the git tree (not the top level), then "git commit" appears to invoke the editor from the top of the tree, with a path like ".git/COMMIT_EDITMSG"; running "lsof -p" on the "sleep" process run in the with-editor shell command confirms that its working directory is the top of the tree, not the directory where I invoked git from my shell, and therefore not the directory specified in default-directory (which is set correctly for my interactive shell's directory). So with-editor tries to edit a file that doesn't exist ($git_top/some/subdir/.git/COMMIT_EDITMSG), tells me how to create the non-existent .git directory, etc.

I'm experimenting with a change to the shell command to use something like:
case "$0" in
/*) echo ... $0 ... ;;
*) echo ... $(pwd -L)/$0 ... ;;
esac; ...

and at least at first it seems to work.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions