git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Steven Penny <svnpenn@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git commit path vs rebase path
Date: Mon, 07 May 2012 10:27:42 -0700	[thread overview]
Message-ID: <7vaa1j7vg1.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAAXzdLU6bQ7ta4_-WfGJVaJgt1R5tX=4PW2sq3SdjAB+F72w+Q@mail.gmail.com> (Steven Penny's message of "Sat, 5 May 2012 23:24:16 -0500")

Steven Penny <svnpenn@gmail.com> writes:

> I have noticed
>
> git commit uses this path
>
> .git/COMMIT_EDITMSG
>
> git rebase uses this path
>
> /home/Steven/jquery/.git/rebase-merge/git-rebase-todo
>
> So git commit is using a relative path while git rebase is using absolute path.
>
> This causes problem in Windows if your editor does not understand linux paths,
> e.g. notepad, Notepad2, Notepad++, etc.

Hrm, this is not limited to rebase, though.  All shell scripted Porcelain
command use git-sh-setup that gives GIT_DIR as the full path, primarily so
that the implementation of the Porcelain can safely chdir around without
having to worry about relative paths in GIT_DIR.

Most of the time, the commands that use git-sh-setup do cd_to_toplevel
very early.  For these commands, unless you are using GIT_DIR from your
own environment (i.e. where people set the environment point to a place
totally unrelated to the working tree and/or the current directory), it
might look nicer if GIT_DIR given were .git/rebase-merge/git-rebase-todo,
but that will not be the real solution, as sometimes your editor _must_
deal with the full path anyway.  So the issue is _not_ that the path is
absolute, it is that the path is given as a wrong kind of absolute path.

Which suggests that "$(cd "$GIT_DIR" && pwd)" must give a full path that
is suitable for the platform, and your platform wants it to be something
like "c:\home\steven\jquery\..."?  I do not have any Windows environment
to further my speculation, so I'll leave the rest to Windows experts who
may be lurking on this list.

The relevant code snippet in git-sh-setup.sh is this part.

# Make sure we are in a valid repository of a vintage we understand,
# if we require to be in a git repository.
if test -z "$NONGIT_OK"
then
	GIT_DIR=$(git rev-parse --git-dir) || exit
	if [ -z "$SUBDIRECTORY_OK" ]
	then
		test -z "$(git rev-parse --show-cdup)" || {
			exit=$?
			echo >&2 "You need to run this command from the toplevel of the working tree."
			exit $exit
		}
	fi
	test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
		echo >&2 "Unable to determine absolute path of git directory"
		exit 1
	}
	: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
fi

  reply	other threads:[~2012-05-07 17:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06  4:24 Git commit path vs rebase path Steven Penny
2012-05-07 17:27 ` Junio C Hamano [this message]
2012-05-08  6:22   ` Johannes Sixt
2012-05-08  6:44     ` Steven Penny
2012-05-08  7:06       ` Johannes Sixt
2012-05-08  7:11         ` Steven Penny
2012-05-08 17:02           ` Junio C Hamano
2012-05-08 17:25             ` Junio C Hamano
2012-05-08 22:47               ` Steven Penny
2012-05-09 21:54                 ` Junio C Hamano
2012-05-09 23:14                   ` Steven Penny
2012-05-10 18:10                 ` Ramsay Jones
2012-05-11  4:35                   ` Steven Penny
2012-05-13 22:58                     ` Ramsay Jones
2012-05-13 23:42                       ` Steven Penny
2012-05-14  6:02                       ` Johannes Sixt
2012-05-15 17:32                         ` Ramsay Jones
2012-05-16  5:52                           ` Johannes Sixt
2012-05-17 18:30                             ` Ramsay Jones
2012-05-17 19:19                               ` Junio C Hamano
2012-05-16 18:00                         ` [PATCH 0/2] " Junio C Hamano
2012-05-16 18:00                           ` [PATCH 1/2] git-sh-setup: define workaround wrappers before they are used Junio C Hamano
2012-05-17 22:36                             ` Ramsay Jones
2012-05-16 18:00                           ` [PATCH 2/2] git-sh-setup: work around Cygwin path handling gotchas Junio C Hamano
2012-05-16 18:51                             ` Steven Penny
2012-05-16 19:02                               ` Junio C Hamano
2012-05-17 23:15                                 ` Ramsay Jones
2012-05-18  2:34                                   ` Junio C Hamano
2012-05-19  0:43                                     ` Steven Penny
2012-05-21 18:43                                     ` Ramsay Jones
2012-05-21 22:24                                       ` Junio C Hamano
2012-05-24 18:27                                         ` Ramsay Jones

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vaa1j7vg1.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=svnpenn@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).