* FIX/COMMENT: git remote manual page
@ 2010-12-22 1:15 Michel Briand
2010-12-25 10:48 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 4+ messages in thread
From: Michel Briand @ 2010-12-22 1:15 UTC (permalink / raw)
To: git
Hello,
I tried the example given at the bottom if the manual page of git
remote.
· Imitate git clone but track only selected branches
$ mkdir project.git
$ cd project.git
$ git init
$ git remote add -f -t master -m master origin git://example.com/git.git/
$ git merge origin
It works like it is written.
But it seems this does not work with my special setup:
- I use GIT_DIR and GIT_WORK_TREE to specify another location for my
repository, and to work from another directory,
- I name my remote with a custom name (not origin).
It fails at the last command :
fatal: <my name> - not something we can merge
But if I try the command :
git merge <my name>/master
the error message is different :
fatal: This operation must be run in a work tree
fatal: read-tree failed
I cd to the work tree and issue the same last command.
Then it works.
I suspect the first error message is related to the remote name. And
the second to the work tree not being the current directory.
Cheers,
Michel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FIX/COMMENT: git remote manual page
2010-12-22 1:15 FIX/COMMENT: git remote manual page Michel Briand
@ 2010-12-25 10:48 ` Nguyen Thai Ngoc Duy
2010-12-25 11:41 ` Michel Briand
0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-12-25 10:48 UTC (permalink / raw)
To: Michel Briand; +Cc: git
On Wed, Dec 22, 2010 at 8:15 AM, Michel Briand <michelbriand@free.fr> wrote:
> Hello,
>
> I tried the example given at the bottom if the manual page of git
> remote.
>
> · Imitate git clone but track only selected branches
>
> $ mkdir project.git
> $ cd project.git
> $ git init
> $ git remote add -f -t master -m master origin git://example.com/git.git/
> $ git merge origin
>
> It works like it is written.
>
> But it seems this does not work with my special setup:
> - I use GIT_DIR and GIT_WORK_TREE to specify another location for my
> repository, and to work from another directory,
> - I name my remote with a custom name (not origin).
So you set GIT_DIR and GIT_WORK_TREE before running "git remote add"?
> It fails at the last command :
>
> fatal: <my name> - not something we can merge
It fails to see "<my name>" points to a commit. Maybe it fails to read
remote information from config..
> But if I try the command :
>
> git merge <my name>/master
>
> the error message is different :
>
> fatal: This operation must be run in a work tree
> fatal: read-tree failed
>
> I cd to the work tree and issue the same last command.
> Then it works.
What git version are use using? I did
GIT_DIR=git/.git GIT_WORK_TREE=git git/git merge origin # or a specific branch
and it worked fine here (recent master). That message means work-tree
settings are not propagated to git-read-tree (run by git-merge).
--
Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FIX/COMMENT: git remote manual page
2010-12-25 10:48 ` Nguyen Thai Ngoc Duy
@ 2010-12-25 11:41 ` Michel Briand
2010-12-25 13:00 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 4+ messages in thread
From: Michel Briand @ 2010-12-25 11:41 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
Nguyen Thai Ngoc Duy <pclouds@gmail.com> - Sat, 25 Dec 2010 17:48:58
+0700
>On Wed, Dec 22, 2010 at 8:15 AM, Michel Briand <michelbriand@free.fr> wrote:
>> Hello,
>>
>> I tried the example given at the bottom if the manual page of git
>> remote.
>>
>> · Imitate git clone but track only selected branches
>>
>> $ mkdir project.git
>> $ cd project.git
>> $ git init
>> $ git remote add -f -t master -m master origin git://example.com/git.git/
>> $ git merge origin
>>
>> It works like it is written.
>>
>> But it seems this does not work with my special setup:
>> - I use GIT_DIR and GIT_WORK_TREE to specify another location for my
>> repository, and to work from another directory,
>> - I name my remote with a custom name (not origin).
>
>So you set GIT_DIR and GIT_WORK_TREE before running "git remote add"?
>
Yes.
>> It fails at the last command :
>>
>> fatal: <my name> - not something we can merge
>
>It fails to see "<my name>" points to a commit. Maybe it fails to read
>remote information from config..
>
Huh, I don't know.
>> But if I try the command :
>>
>> git merge <my name>/master
>>
>> the error message is different :
>>
>> fatal: This operation must be run in a work tree
>> fatal: read-tree failed
>>
>> I cd to the work tree and issue the same last command.
>> Then it works.
>
>What git version are use using? I did
>
>GIT_DIR=git/.git GIT_WORK_TREE=git git/git merge origin # or a specific branch
>
>and it worked fine here (recent master). That message means work-tree
>settings are not propagated to git-read-tree (run by git-merge).
Hi,
I'm running Debian squeeze. Git is version 1.7.2.3.
Here is the complete command sequence I used:
~/tmp/git $ mkdir toto toto_wk
~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git init
Initialized empty Git repository in xxxxxxxxxxxxxxxx/tmp/git/toto/
~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git remote add -f -t master -m master TOTO xxxxxx/shlib
Updating TOTO
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 36 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (36/36), done.
From xxxxxxxxxxxxxxxxx/shlib
* [new branch] master -> TOTO/master
From xxxxxxxxxxxxxxxxx/shlib
* [new tag] 1.0 -> 1.0
* [new tag] 1.0.1 -> 1.0.1
~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
fatal: This operation must be run in a work tree
fatal: read-tree failed
~/tmp/git $ ls toto_wk/
<NOTHING>
I re-issue the latest command :
~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
Already up-to-date.
Strange isn't it ?
But directory is still empty
~/tmp/git $ ls toto_wk/
<NOTHING>
Trying to recover :
~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git reset --hard
The directory is correct (in sync with my master branch).
If I do :
...git init
...git remote add...
cd toto_wk
GIT_DIR=../toto GIT_WORK_TREE=. git merge TOTO
It works !
Adding /master after remote name doesn't make any difference. Please
forget this idea.
The problem seems to reside in the work tree parameter (. or not).
Cheers,
Michel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FIX/COMMENT: git remote manual page
2010-12-25 11:41 ` Michel Briand
@ 2010-12-25 13:00 ` Nguyen Thai Ngoc Duy
0 siblings, 0 replies; 4+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-12-25 13:00 UTC (permalink / raw)
To: Michel Briand; +Cc: git
On Sat, Dec 25, 2010 at 6:41 PM, Michel Briand <michelbriand@free.fr> wrote:
> Hi,
>
> I'm running Debian squeeze. Git is version 1.7.2.3.
>
> Here is the complete command sequence I used:
>
> ~/tmp/git $ mkdir toto toto_wk
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git init
Note that this also sets core.worktree=`cwd`/toto_wk so you only need
to set GIT_DIR in the following commands. But I wouldn't recommend it,
just set GIT_WORK_TREE the way you are doing, until maybe 1.7.4.
core.worktree is buggy.
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
> fatal: This operation must be run in a work tree
> fatal: read-tree failed
Thanks for the instructions. We've got a problem with $GIT_WORK_TREE
vs cwd here. I'll send a patch later.
> ~/tmp/git $ ls toto_wk/
> <NOTHING>
>
> I re-issue the latest command :
>
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
> Already up-to-date.
>
> Strange isn't it ?
Actually no. 'git-merge' is successful and its last step is to call
'git read-tree --reset -u SHA-1' to update worktree. Unfortunately,
git's internal cwd has been moved to ~/tmp/git/toto_wk while
$GIT_WORK_TREE is still "toto_wk". When git-read-tree is run, it tries
to find a worktree at ~/tmp/git/toto_wk/toto_wk.
> But directory is still empty
> ~/tmp/git $ ls toto_wk/
> <NOTHING>
Because git-read-tree fails to run.
> Trying to recover :
>
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git reset --hard
Or you can try this until new git release:
GIT_DIR=toto GIT_WORK_TREE=$HOME/tmp/toto_wk git merge TOTO
or
GIT_DIR=toto git merge TOTO
In other words, making worktree absolute should work (core.worktree is
always set absolute by git-init).
--
Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-25 13:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 1:15 FIX/COMMENT: git remote manual page Michel Briand
2010-12-25 10:48 ` Nguyen Thai Ngoc Duy
2010-12-25 11:41 ` Michel Briand
2010-12-25 13:00 ` Nguyen Thai Ngoc Duy
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).