From: Michael J Gruber <git@drmicha•warpmail.net>
To: Alexander Gladysh <agladysh@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: git rebase does not understand --work-tree
Date: Wed, 14 Jul 2010 14:54:46 +0200 [thread overview]
Message-ID: <4C3DB396.2040109@drmicha.warpmail.net> (raw)
In-Reply-To: <AANLkTimnk6tflv9ZZCydlX1la35GjsRfvjgTk44uDFbO@mail.gmail.com>
Alexander Gladysh venit, vidit, dixit 14.07.2010 11:04:
> Hi, list!
>
> $ git --version
> git version 1.7.1.1
>
> I often use --work-tree and --git-dir to avoid doing cd in my scripts.
>
> However, I've found that git rebase does not understand --work-tree
> option (see test below). Is this fixable?
>
> Thanks,
> Alexander.
In your case, omitting --work-tree almost works, as well as using
"--work-tree=." (note the dot). "Almost" meaning that rebase does not
complain. It just doesn't find the work-tree.
I think the main problem here is a problem with relative work trees.
First of all, work tree is meant to be relative to (the repo specified
by) GIT_DIR, but that's not what "git rev-parse --top-level" is doing.
Experimenting with relative --git-dir and --work-tree here shows that
it's relative to cwd.
Second, several git shell commands (such as rebase) cd to the toplevel
of the repo only after checking whether we are in a work tree already.
This is brain dead and should be cured by the upcoming patch. With that,
absolute paths for work-tree will work with rebase.
Third, git's setup code exports GIT_DIR as an absolute path but
GIT_WORK_TREE as a relative path. Together with the fact that the work
tree is interpreted relative to the current directory, this is doomed
for failure when you cd around - as rebase does automatically!
I'm not sure I find time for the latter point, but until then the patch
enables you to work with absolute paths.
Michael
next prev parent reply other threads:[~2010-07-14 12:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 9:04 git rebase does not understand --work-tree Alexander Gladysh
2010-07-14 12:54 ` Michael J Gruber [this message]
2010-07-14 12:55 ` [RFC/PATCH] am/pull/rebase/stash: cd_to_toplevel before require_work_tree Michael J Gruber
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=4C3DB396.2040109@drmicha.warpmail.net \
--to=git@drmicha$(echo .)warpmail.net \
--cc=agladysh@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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