All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Drews <paul.drews@intel.com>
To: git@vger.kernel.org
Subject: Re: rebase not honoring core.worktree pointing elsewhere
Date: Tue, 2 Nov 2010 16:26:49 +0000 (UTC)	[thread overview]
Message-ID: <loom.20101102T165800-486@post.gmane.org> (raw)
In-Reply-To: AANLkTi=ejRcnz+83zc2Z-6etUGMsBSw1FFUY0JNFRFGB@mail.gmail.com

Nguyen Thai Ngoc Duy <pclouds <at> gmail.com> writes:

> First of all, core.worktree should not matter because GIT_DIR has not
> been set (No don't trust core.worktree documentation, it's equivalent
> to --work-tree in "man git"). You need to set GIT_DIR (or --git-dir).
> That's a bug I'm working on.
> 
> Then, yes, rebase should be updated to use worktree even if it's
> outside cwd. I'm not sure how to do it properly in git-rebase.sh
> though.  The requirement "require_work_tree" can be loosen a bit.

Thanks,
I can confirm that the following works:

() have /abs/path/to/wheregitis/.git
() have /abs/path/to/wherefilesare
() export GIT_DIR=/abs/path/to/wheregitis/.git
() DO NOT have core.worktree (or related items) set
() cd /abs/path/to/wherefilesare
() git rebase master

This is a bit more dangerous than running git commands in GIT_DIR and pointing
core.worktree elsewhere, since I could make the error of (1) leaving GIT_DIR
unintentionally still set when doing something else, or (2) running git commands
outside the (unmarked) root of the worktree.  Still... it works.

BTW, the impetus for this is a big integrated cross-compilation build system
that has a nasty habit of deleting and re-creating a chroot environment
containing the directory structures including the work tree.  If the ".git"
dir is at the "normal" place "inside" the work tree, it gets deleted along
with all the work I have done.  Not good, which is why I want to keep the
".git" somewhere else that's safe.  Solutions to this:

(preferred) core.worktree pointing into worktree elsewhere, run all git
commands from GIT_DIR.  Would be great if rebase worked under these
circumstances.

(best fallback) no core.worktree, export GIT_DIR pointing elsewhere, run all
git commands from unmarked root of worktree.

(complex) A complex scenario pushing and pulling stuff between a git repo
inside the worktree and another git clone outside the worktree.

(implementation dependent) Having the ".git" dir inside the worktree be a
symbolic link to a dir somewhere outside the work tree.  Keeps the actual ".git"
contents safe from deletion.  Works so far, but this is Tampering With The
Implementation in a way that is likely to fail down the road somewhere,
e.g., if an internal script does cd to the GIT_DIR, then cd relative to
that to try to get back into somewhere else in the work tree.

  parent reply	other threads:[~2010-11-02 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 17:22 rebase not honoring core.worktree pointing elsewhere Paul Drews
2010-11-01 17:38 ` Sverre Rabbelier
2010-11-02  0:11 ` Nguyen Thai Ngoc Duy
2010-11-02  1:21   ` Junio C Hamano
2010-11-02 16:26   ` Paul Drews [this message]
2010-11-03  0:13     ` Nguyen Thai Ngoc Duy
2010-11-03 15:41       ` Paul Drews
2010-11-03 15:52         ` Nguyen Thai Ngoc Duy
2010-11-03 16:13         ` Jonathan Nieder
2010-11-04 14:20           ` Nguyen Thai Ngoc Duy

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=loom.20101102T165800-486@post.gmane.org \
    --to=paul.drews@intel.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.