threads / discuss / 5568

Tracking a branch using StGIT

Subject: Tracking a branch using StGIT

## tl;dr

10 messages between Sep 15, 2006 and Sep 15, 2006.

replies: 9people: 6as markdown or json

Rajkumar S· Sep 15, 2006, 08:20 UTC · lore
Hi,

I am using StGIT to track a branch of a remote git repository (actually a remote cvs repository, which I am tracking cvsimport)

The remote repository git branch show:
  Package-Reorg-2005
  RELENG_1
  avendor
* master
  origin
My local repository has:

root@beastie:# stg branch -l Available branches:

> s     MyBranch            | clone of "RELENG_1"
        Package-Reorg-2005  |
  s     RELENG_1            |
        avendor             |
        master              |
        origin              |
The .git/remotes/origin is
URL: /usr/local/pfSense/upstream/pfSense/.git
Pull: refs/heads/master:refs/heads/origin
Pull: refs/heads/avendor:refs/heads/avendor
Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
Pull: refs/heads/RELENG_1:refs/heads/RELENG_1

My requirement is to track RELENG_1 branch with StGIT while maintaining my own patches. but when I do a stg pull the messages are:

Popping all applied patches... done Pulling from "origin"... Trying really trivial in-index merge... fatal: Merge requires file-level merging Nope. Merging HEAD with c0a06b86b8431293214f5eb18e49fcb8117c6070 Merging: 997e28966d7b7964562232628cc4f64dccbead9e Execute after commands via sh & c0a06b86b8431293214f5eb18e49fcb8117c6070 Execute after commands via sh & found 1 common ancestor(s): 1b08ecedad1e6a7199f12d1fad97373587c85454 Minor nitpick. <br> after firmware branch select box CONFLICT (add/add): File usr/local/www/status_filter_reload.php added non-identically in both branches. Adding as usr/local/www/status_filter_reload.php~HEAD and usr/local/www/status_filter_reload.php~c0a06b86b8431293214f5eb18e49fcb8117c6070 instead. <snip>

It seems StGIT is trying to merge the origin branch from remote to RELENG_1 of local. Is there a way to get RELENG_1 of remote to merge with MyBranch (clone of "RELENG_1") of local?

raj
Catalin Marinas· Sep 15, 2006, 10:42 UTC · re: Rajkumar S · lore

Re: Tracking a branch using StGIT

On 15/09/06, Rajkumar S <rajkumars+git@gmail.com> wrote:
> I am using StGIT to track a branch of a remote git repository
> (actually a remote cvs repository, which I am tracking cvsimport)
[...]
Show 9 quoted lines
> The .git/remotes/origin is
> URL: /usr/local/pfSense/upstream/pfSense/.git
> Pull: refs/heads/master:refs/heads/origin
> Pull: refs/heads/avendor:refs/heads/avendor
> Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
> Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
>
> My requirement is to track RELENG_1 branch with StGIT while
> maintaining my own patches. but when I do a stg pull the messages are:
[...]
> It seems StGIT is trying to merge the origin branch from remote to
> RELENG_1 of local. Is there a way to get RELENG_1 of remote to merge
> with MyBranch (clone of "RELENG_1") of local?

After StGIT pops all the patches, it just calls "git pull origin". My understanding of GIT is that this should update local RELENG_1 with the remote RELENG_1 from the "origin" repository. Anything wrong with my assumptions?

-- 
Catalin
Andy Whitcroft· Sep 15, 2006, 10:58 UTC · re: Catalin Marinas · lore

Re: Tracking a branch using StGIT

Catalin Marinas wrote:
Show 23 quoted lines
> On 15/09/06, Rajkumar S <rajkumars+git@gmail.com> wrote:
>> I am using StGIT to track a branch of a remote git repository
>> (actually a remote cvs repository, which I am tracking cvsimport)
> [...]
>> The .git/remotes/origin is
>> URL: /usr/local/pfSense/upstream/pfSense/.git
>> Pull: refs/heads/master:refs/heads/origin
>> Pull: refs/heads/avendor:refs/heads/avendor
>> Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
>> Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
>>
>> My requirement is to track RELENG_1 branch with StGIT while
>> maintaining my own patches. but when I do a stg pull the messages are:
> [...]
>> It seems StGIT is trying to merge the origin branch from remote to
>> RELENG_1 of local. Is there a way to get RELENG_1 of remote to merge
>> with MyBranch (clone of "RELENG_1") of local?
> 
> After StGIT pops all the patches, it just calls "git pull origin". My
> understanding of GIT is that this should update local RELENG_1 with
> the remote RELENG_1 from the "origin" repository. Anything wrong with
> my assumptions?
> 

Well that will update origin, and then merge the result with the current branch. That second part probabally isn't what you had in mind. Normally you would git fetch origin to stop that happening, but that also can't update the branch you are on.

Not sure if this helps.
-apw
Santi· Sep 15, 2006, 11:17 UTC · re: Catalin Marinas · lore

Re: Tracking a branch using StGIT

2006/9/15, Catalin Marinas <catalin.marinas@gmail.com>:
Show 23 quoted lines
> On 15/09/06, Rajkumar S <rajkumars+git@gmail.com> wrote:
> > I am using StGIT to track a branch of a remote git repository
> > (actually a remote cvs repository, which I am tracking cvsimport)
> [...]
> > The .git/remotes/origin is
> > URL: /usr/local/pfSense/upstream/pfSense/.git
> > Pull: refs/heads/master:refs/heads/origin
> > Pull: refs/heads/avendor:refs/heads/avendor
> > Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
> > Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
> >
> > My requirement is to track RELENG_1 branch with StGIT while
> > maintaining my own patches. but when I do a stg pull the messages are:
> [...]
> > It seems StGIT is trying to merge the origin branch from remote to
> > RELENG_1 of local. Is there a way to get RELENG_1 of remote to merge
> > with MyBranch (clone of "RELENG_1") of local?
>
> After StGIT pops all the patches, it just calls "git pull origin". My
> understanding of GIT is that this should update local RELENG_1 with
> the remote RELENG_1 from the "origin" repository. Anything wrong with
> my assumptions?
>

No. But the it merge the first pull line in .git/remotes/origin into the current branch. So he only has to put the RELENG_1 line the first, as:

URL: /usr/local/pfSense/upstream/pfSense/.git
Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
Pull: refs/heads/master:refs/heads/origin
Pull: refs/heads/avendor:refs/heads/avendor
Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
Santi
Rajkumar S· Sep 15, 2006, 11:34 UTC · re: Santi · lore

Re: Tracking a branch using StGIT

On 9/15/06, Santi <sbejar@gmail.com> wrote:
Show 6 quoted lines
> No. But the it merge the first pull line in .git/remotes/origin into
> the current branch. So he only has to put the RELENG_1 line the first,
> as:
>
> URL: /usr/local/pfSense/upstream/pfSense/.git
> Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
Thanks a lot, that should solve this.
raj
Rajkumar S· Sep 15, 2006, 11:32 UTC · re: Catalin Marinas · lore

Re: Tracking a branch using StGIT

On 9/15/06, Catalin Marinas <catalin.marinas@gmail.com> wrote:
> After StGIT pops all the patches, it just calls "git pull origin". My
> understanding of GIT is that this should update local RELENG_1 with
> the remote RELENG_1 from the "origin" repository. Anything wrong with
> my assumptions?

I checked this again, this time with out using stgit, and the results are the same. So this is not a StGIT problem but a user error :(

My sequence of test is as follows:
# root@beastie:# git clone /usr/local/pfSense/upstream/pfSense/ releng_1
<snip>
 100% (1220/1220) done
# cd releng_1/
# cat .git/remotes/origin
URL: /usr/local/pfSense/upstream/pfSense/.git
Pull: refs/heads/master:refs/heads/origin
Pull: refs/heads/avendor:refs/heads/avendor
Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
# git branch
  Package-Reorg-2005
  RELENG_1
  avendor
* master
  origin

# git pull Already up-to-date.

# git checkout RELENG_1

# git pull Trying really trivial in-index merge... fatal: Merge requires file-level merging Nope. Merging HEAD with c0a06b86b8431293214f5eb18e49fcb8117c6070 Merging: 997e28966d7b7964562232628cc4f64dccbead9e Execute after commands via sh & c0a06b86b8431293214f5eb18e49fcb8117c6070 Execute after commands via sh & found 1 common ancestor(s): 1b08ecedad1e6a7199f12d1fad97373587c85454 Minor nitpick. <br> after firmware branch select box

As you can see, when I switched to RELENG_1 branch and did a git pull, I am getting errors. I am wondering where I am wrong.

raj
Jakub Narebski· Sep 15, 2006, 11:42 UTC · re: Rajkumar S · lore

Re: Tracking a branch using StGIT

Rajkumar S wrote:
Show 37 quoted lines
> On 9/15/06, Catalin Marinas <catalin.marinas@gmail.com> wrote:
> 
>> After StGIT pops all the patches, it just calls "git pull origin". My
>> understanding of GIT is that this should update local RELENG_1 with
>> the remote RELENG_1 from the "origin" repository. Anything wrong with
>> my assumptions?
> 
> I checked this again, this time with out using stgit, and the results
> are the same. So this is not a StGIT problem but a user error :(
> 
> My sequence of test is as follows:
> 
> # root@beastie:# git clone /usr/local/pfSense/upstream/pfSense/ releng_1
> <snip>
>  100% (1220/1220) done
> # cd releng_1/
> 
> # cat .git/remotes/origin
> URL: /usr/local/pfSense/upstream/pfSense/.git
> Pull: refs/heads/master:refs/heads/origin
> Pull: refs/heads/avendor:refs/heads/avendor
> Pull: refs/heads/Package-Reorg-2005:refs/heads/Package-Reorg-2005
> Pull: refs/heads/RELENG_1:refs/heads/RELENG_1
> 
> # git branch
>   Package-Reorg-2005
>   RELENG_1
>   avendor
> * master
>   origin
> 
> # git pull
> Already up-to-date.
> 
> # git checkout RELENG_1
> 
> # git pull
[...]
> 
> As you can see, when I switched to RELENG_1 branch and did a git pull,
> I am getting errors. I am wondering where I am wrong.

git pull is git fetch + merge of first head in remotes file with _current_ branch.

You'd better git fetch if you are on RELENG_1 branch (if you are not on master), then git checkout master && git pull . origin

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Rajkumar S· Sep 15, 2006, 11:59 UTC · re: Jakub Narebski · lore

Re: Tracking a branch using StGIT

On 9/15/06, Jakub Narebski <jnareb@gmail.com> wrote:
> git pull is git fetch + merge of first head in remotes file with _current_
> branch.

I was under the impression that git pull is git pull + merge of corresponding branches in remotes files. ie master -> origin and RELENG_1 -> RELENG_1. Is such a pull possible, for all lines in remotes file?

In my case I am only interested in RELENG_1 branch, so would it be fine if I just put the "Pull: refs/heads/RELENG_1:refs/heads/RELENG_1" line in my remotes file? Since I use StGIT I do not intend to modify my local RELENG_1 branch except by StGIT patches, so all pulls from remote should be fast forward merged. Thus if the stg pull can pull in the remote RELENG_1 to local RELENG_1 with patched popped, and fastforward merge it, it would be great.

raj
Jakub Narebski· Sep 15, 2006, 12:09 UTC · re: Rajkumar S · lore

Re: Tracking a branch using StGIT

Rajkumar S wrote:
Show 9 quoted lines
> On 9/15/06, Jakub Narebski <jnareb@gmail.com> wrote:
> 
>> git pull is git fetch + merge of first head in remotes file with _current_
>> branch.
> 
> I was under the impression that git pull is git pull + merge of
> corresponding branches in remotes files. ie master -> origin and
> RELENG_1 -> RELENG_1. Is such a pull possible, for all lines in
> remotes file?
GIT-PULL(1)
DESCRIPTION
       Runs  git-fetch with the given parameters, and calls git-merge to merge the
       retrieved head(s) into the current branch.

Besides in remotes file you have only specified which remote branch is tracked by which local branch. Additionally all but first are marked as not-for-merge. There is no place for default branch to merge with.

There was some discussion about moving remotes information into config file, including marking tracking branches as read-only, marking default branch to merge (or marking branch as for-merge/not-for-merge), marking branch as of not fast-forwarding type (like 'pu' in git.git) on the _server_ side etc. But it petered out, unfortunately.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Rajkumar S· Sep 15, 2006, 12:18 UTC · re: Jakub Narebski · lore

Re: Tracking a branch using StGIT

On 9/15/06, Jakub Narebski <jnareb@gmail.com> wrote:
Show 9 quoted lines
> Besides in remotes file you have only specified which remote branch
> is tracked by which local branch. Additionally all but first are marked
> as not-for-merge. There is no place for default branch to merge with.
>
> There was some discussion about moving remotes information into config
> file, including marking tracking branches as read-only, marking default
> branch to merge (or marking branch as for-merge/not-for-merge), marking
> branch as of not fast-forwarding type (like 'pu' in git.git) on the
> _server_ side etc. But it petered out, unfortunately.

Thanks a lot for your comments, I have just put the RELENG_1 line in the remotes and have RELENG_1 always checked out.

raj

← back to recent threads