Re: Git commit path vs rebase path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steven Penny <svnpenn@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]