git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git_path() returns relative paths
@ 2013-07-27 11:10 Ramkumar Ramachandra
  2013-07-27 11:48 ` Duy Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-27 11:10 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

Hi,

I noticed a regression in the latest master, and I've been trying to
debug it for 30 minutes now.  I'm still clueless about the root cause,
but I'll list whatever I found so far:

I suddenly noticed that I wasn't able to commit to a certain
repository with submodules anymore.  This was because git commit was
opening a COMMIT_EDITMSG in the wrong path.  To reproduce the problem,
you need a setup like mine:

  ~/dotfiles is a repository containing submodules
  ~/.elisp is a symbolic link to ~/dotfiles/.elisp, a normal directory
  ~/.elisp/flx is the submodule repository to which I'm trying to commit

The buffer-file-name of COMMIT_EDITMSG comes out as
/home/artagnon/.git/modules/flx/.git/COMMIT_EDITMSG, which is
completely wrong because ~ does not even contain a .git.

So, I started debugging the issue with this patch:

diff --git a/builtin/commit.c b/builtin/commit.c
index 003bd7d..38a7c77 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -678,6 +678,9 @@ static int prepare_to_commit(const char
                hook_arg2 = "";
        }

+       char *buf = get_current_dir_name();
+       die("DBG: %s | %s", buf, git_path(commit_editmsg));
+
        s->fp = fopen(git_path(commit_editmsg), "w");
        if (s->fp == NULL)
                die_errno(_("could not open '%s'"), git_path(commit_editmsg));

On master, commit returns:

  fatal: DBG: /home/artagnon/.elisp/flx |
../../.git/modules/.elisp/flx/COMMIT_EDITMSG

When backported to v1.8.3.3, commit returns:

  fatal: DBG: /home/artagnon/.elisp/flx |
/home/artagnon/dotfiles/.git/modules/.elisp/flx/COMMIT_EDITMSG

I tried looking through the logs to see what has changed in
path.c/environment.c, but have come up with nothing so far.  I think
I'll have to resort to using a hammer like bisect now.

*scratches head*

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-07-28  9:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-07-28  9:24               ` Ramkumar Ramachandra
2013-07-27 12:14 ` Fredrik Gustafsson
2013-07-27 13:26   ` Ramkumar Ramachandra

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).