git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Xin Jiang <worldhello.net@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [BUG] git_path() returns relative paths
Date: Sun, 28 Jul 2013 12:00:09 +0700	[thread overview]
Message-ID: <20130728050009.GA10844@lanh> (raw)
In-Reply-To: <CALkWK0=xuNGM54=Kodfi9L8_yUOaXrWvqiMHbx2SRTH1CmZxLA@mail.gmail.com>

On Sat, Jul 27, 2013 at 09:35:40PM +0530, Ramkumar Ramachandra wrote:
> Duy Nguyen wrote:
> > I was involved with this code (the gitdir setup code, not submodule)
> > and am interested to know what's going on too. Could you produce a
> > small script to reproduce it?
> 
> Here's your reduced testcase. Just point mygit to a HEAD build.
> 
>   #!/bin/sh
> 
>   mygit=~/src/git/git
>   cd /tmp
>   $mygit clone https://github.com/artagnon/clayoven
>   cd clayoven
>   $mygit submodule add https://github.com/lewang/flx .elisp/flx
>   $mygit commit -a -m "Added submodule"
>   cd /tmp
>   ln -s clayoven/.elisp
>   cd .elisp/flx
>   EDITOR="emacs -Q" git commit --amend
>   # buffer-file-name = "/tmp/.git/modules/.elisp/flx/COMMIT_EDITMSG"
> 
> Note that this is emacs 24.3. I used -Q to make sure that none of my
> init magic (magit etc.) was responsible for changing directories or
> doing something equally stupid. However, considering that it's
> impossible to reproduce the problem with either cat or vim as the
> EDITOR, you might be inclined to classify this as an Emacs bug. In
> that case, why can't I reproduce it without submodules?

How about something like this as a workaround for emacs?

-- 8< --
diff --git a/editor.c b/editor.c
index 27bdecd..fda3e41 100644
--- a/editor.c
+++ b/editor.c
@@ -37,7 +37,8 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
 		return error("Terminal is dumb, but EDITOR unset");
 
 	if (strcmp(editor, ":")) {
-		const char *args[] = { editor, path, NULL };
+		char *rpath = realpath(path, NULL);
+		const char *args[] = { editor, rpath, NULL };
 		struct child_process p;
 		int ret, sig;
 
@@ -51,6 +52,7 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
 		sigchain_push(SIGINT, SIG_IGN);
 		sigchain_push(SIGQUIT, SIG_IGN);
 		ret = finish_command(&p);
+		free(rpath);
 		sig = ret - 128;
 		sigchain_pop(SIGINT);
 		sigchain_pop(SIGQUIT);
-- 8< --

> 
> I'm going off to eat cake before I tear my hair out in frustration.

  parent reply	other threads:[~2013-07-28  5:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 11:10 [BUG] git_path() returns relative paths Ramkumar Ramachandra
2013-07-27 11:48 ` Duy Nguyen
2013-07-27 12:05 ` Ramkumar Ramachandra
2013-07-27 12:31   ` Ramkumar Ramachandra
2013-07-27 12:47     ` Duy Nguyen
2013-07-27 14:33       ` Ramkumar Ramachandra
2013-07-27 15:17         ` Duy Nguyen
2013-07-27 16:05           ` Ramkumar Ramachandra
2013-07-27 23:25             ` Jiang Xin
2013-07-28  0:03               ` Ramkumar Ramachandra
2013-07-28  4:37             ` Duy Nguyen
2013-07-28  8:49               ` Ramkumar Ramachandra
2013-07-28  9:06                 ` Duy Nguyen
2013-07-28  9:16                   ` Ramkumar Ramachandra
2013-07-28  5:00             ` Duy Nguyen [this message]
2013-07-28  9:24               ` Ramkumar Ramachandra
2013-07-27 12:14 ` Fredrik Gustafsson
2013-07-27 13:26   ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130728050009.GA10844@lanh \
    --to=pclouds@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=worldhello.net@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).