From: Jeff King <peff@peff.net>
To: Ram Rachum <ram@rachum.com>
Cc: git@vger.kernel.org
Subject: Re: Using alternate working directory
Date: Tue, 24 Sep 2013 01:00:11 -0400 [thread overview]
Message-ID: <20130924050011.GE2766@sigill.intra.peff.net> (raw)
In-Reply-To: <523E09D8.8090808@rachum.com>
On Sun, Sep 22, 2013 at 12:04:24AM +0300, Ram Rachum wrote:
> I'm making a script `gm` which lets me merge one branch into another
> without having either checked out. It works for some cases but not
> all. I'm trying to make it work for more cases.
>
> I concluded that the best way to do it would be by using an
> alternate, temporary working directory instead of the repo itself.
Yes, otherwise you will be stomping all over the working tree of
whatever branch _is_ checked out.
> This is my script:
>
> https://gist.github.com/cool-RR/6575042
>
> Now, the problem is that when I try it, it gives these errors:
>
> git checkout-index: my_file is not in the cache and then error:
> my_file: cannot add to the index - missing --add option?
>
> Anyone has any idea what to do?
Your script is quite similar to the one that is used server-side at
GitHub to generate the "this can be merged" button for each pull
request. So it should work in principle.
Just a guess, but using a relative path for the temporary index file
might be a problem. read-tree will operate from $GIT_DIR as its working
directory, for example, but I think the git-merge-one-file script will
be at the top-level of $GIT_WORK_TREE. Meaning that all of the
sub-commands it runs will see an empty index.
-Peff
prev parent reply other threads:[~2013-09-24 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-21 21:04 Using alternate working directory Ram Rachum
2013-09-24 4:27 ` Ram Rachum
2013-09-24 5:00 ` Jeff King [this message]
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=20130924050011.GE2766@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=ram@rachum.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.
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).