git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Using alternate working directory
@ 2013-09-21 21:04 Ram Rachum
  2013-09-24  4:27 ` Ram Rachum
  2013-09-24  5:00 ` Jeff King
  0 siblings, 2 replies; 3+ messages in thread
From: Ram Rachum @ 2013-09-21 21:04 UTC (permalink / raw)
  To: git

Hi everybody!

I need some help with Git.

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.

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?

P.S. I've also asked this on Stack Overflow, so whoever comes up with an 
answer can claim his 150 imaginary internet points on that question.


Thanks,
Ram.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using alternate working directory
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Ram Rachum @ 2013-09-24  4:27 UTC (permalink / raw)
  To: git

Does anyone care to help? I'd really like to solve this  :(

On 22/9/2013 00:04, Ram Rachum wrote:
> Hi everybody!
>
> I need some help with Git.
>
> 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.
>
> 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?
>
> P.S. I've also asked this on Stack Overflow, so whoever comes up with 
> an answer can claim his 150 imaginary internet points on that question.
>
>
> Thanks,
> Ram.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using alternate working directory
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2013-09-24  5:00 UTC (permalink / raw)
  To: Ram Rachum; +Cc: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-24  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).