Skip to content

Commit

Permalink
Fetch the correct remote branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mark2185 committed Jun 1, 2022
1 parent f9a3188 commit 55a941d
Show file tree
Hide file tree
Showing 50 changed files with 112 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/gui/controllers/branches_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (self *BranchesController) fastForward(branch *models.Branch) error {
err := self.git.Sync.Pull(
git_commands.PullOptions{
RemoteName: branch.UpstreamRemote,
BranchName: branch.Name,
BranchName: branch.UpstreamBranch,
FastForwardOnly: true,
},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
[remote "origin"]
url = /home/mark/Downloads/gits/lazygit/test/integration/fetchRemoteBranchWithNonmatchingName/actual/./repo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��A
�0@Q�9�����I
"BW=F�L��!R"����~�����r�*�J��d ��¬�D�j���E��<x����v�f�M�C?�^�^r�;� L9�pF��zL��ɝ}�)�2�,�
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��A
� E��� �q�D!�BV9��#�& ������y��y�um]�)�m��� !�HXJ̀�� ���ɢ�xʫ�6�G� t~L��.$�������z^�4/��zlr��5 ��x��k��m?��O\�oY7A��?:l
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
b090d7f0029e74de260f7458721b8edd1e618edc refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myfile4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b090d7f0029e74de260f7458721b8edd1e618edc branch 'master' of ../origin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master-local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12d38e54cd419303587ba4613fb1194ec5c9d04f
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = [email protected]
name = CI
[remote "origin"]
url = ../origin
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master-local"]
remote = origin
merge = refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
0000000000000000000000000000000000000000 3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 CI <[email protected]> 1654108479 +0200 commit (initial): myfile1
3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108479 +0200 commit: myfile2
12d38e54cd419303587ba4613fb1194ec5c9d04f 72ee6cc86de71389b9c70e24c7d8c8837e7d3566 CI <[email protected]> 1654108479 +0200 commit: myfile3
72ee6cc86de71389b9c70e24c7d8c8837e7d3566 b090d7f0029e74de260f7458721b8edd1e618edc CI <[email protected]> 1654108479 +0200 commit: myfile4
b090d7f0029e74de260f7458721b8edd1e618edc 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108479 +0200 reset: moving to HEAD~2
12d38e54cd419303587ba4613fb1194ec5c9d04f 0000000000000000000000000000000000000000 CI <[email protected]> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
0000000000000000000000000000000000000000 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
12d38e54cd419303587ba4613fb1194ec5c9d04f b090d7f0029e74de260f7458721b8edd1e618edc CI <[email protected]> 1654108482 +0200 pull --no-edit --ff-only origin master: Fast-forward
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0000000000000000000000000000000000000000 3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 CI <[email protected]> 1654108479 +0200 commit (initial): myfile1
3e5a250f3b6d2ea4ea93b3006aaceeb75bb8d0b6 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108479 +0200 commit: myfile2
12d38e54cd419303587ba4613fb1194ec5c9d04f 72ee6cc86de71389b9c70e24c7d8c8837e7d3566 CI <[email protected]> 1654108479 +0200 commit: myfile3
72ee6cc86de71389b9c70e24c7d8c8837e7d3566 b090d7f0029e74de260f7458721b8edd1e618edc CI <[email protected]> 1654108479 +0200 commit: myfile4
b090d7f0029e74de260f7458721b8edd1e618edc 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108479 +0200 reset: moving to HEAD~2
12d38e54cd419303587ba4613fb1194ec5c9d04f 12d38e54cd419303587ba4613fb1194ec5c9d04f CI <[email protected]> 1654108482 +0200 Branch: renamed refs/heads/master to refs/heads/master-local
12d38e54cd419303587ba4613fb1194ec5c9d04f b090d7f0029e74de260f7458721b8edd1e618edc CI <[email protected]> 1654108482 +0200 pull --no-edit --ff-only origin master: Fast-forward
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0000000000000000000000000000000000000000 b090d7f0029e74de260f7458721b8edd1e618edc CI <[email protected]> 1654108479 +0200 fetch origin: storing head
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��A
�0@Q�9�����I
"BW=F�L��!R"����~�����r�*�J��d ��¬�D�j���E��<x����v�f�M�C?�^�^r�;� L9�pF��zL��ɝ}�)�2�,�
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��A
� E��� �q�D!�BV9��#�& ������y��y�um]�)�m��� !�HXJ̀�� ���ɢ�xʫ�6�G� t~L��.$�������z^�4/��zlr��5 ��x��k��m?��O\�oY7A��?:l
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b090d7f0029e74de260f7458721b8edd1e618edc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b090d7f0029e74de260f7458721b8edd1e618edc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"KeyEvents":[{"Timestamp":703,"Mod":0,"Key":256,"Ch":108},{"Timestamp":1151,"Mod":0,"Key":256,"Ch":82},{"Timestamp":1692,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2183,"Mod":0,"Key":256,"Ch":45},{"Timestamp":2372,"Mod":0,"Key":256,"Ch":108},{"Timestamp":2498,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2617,"Mod":0,"Key":256,"Ch":99},{"Timestamp":2663,"Mod":0,"Key":256,"Ch":97},{"Timestamp":2724,"Mod":0,"Key":256,"Ch":108},{"Timestamp":3196,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3837,"Mod":0,"Key":256,"Ch":102},{"Timestamp":4854,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":213,"Height":56}]}
36 changes: 36 additions & 0 deletions test/integration/fetchRemoteBranchWithNonmatchingName/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

set -e

set -e

cd $1

git init

git config user.email "[email protected]"
git config user.name "CI"

echo test1 > myfile1
git add .
git commit -am "myfile1"
echo test2 > myfile2
git add .
git commit -am "myfile2"
echo test3 > myfile3
git add .
git commit -am "myfile3"
echo test4 > myfile4
git add .
git commit -am "myfile4"

cd ..
git clone --bare ./repo origin

cd repo

git reset --hard HEAD~2
git remote add origin ../origin
git fetch origin
git branch --set-upstream-to=origin/master

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "description": "allow unsetting the upstream of the current branch", "speed": 10 }

0 comments on commit 55a941d

Please sign in to comment.