Page MenuHomeFreeBSD

Makefile: Force to rebase when using make update
ClosedPublic

Authored by sbz on May 25 2021, 7:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 7:30 PM
Unknown Object (File)
Nov 20 2024, 12:07 AM
Unknown Object (File)
Nov 16 2024, 6:49 AM
Unknown Object (File)
Oct 17 2024, 4:22 PM
Unknown Object (File)
Sep 30 2024, 7:27 AM
Unknown Object (File)
Sep 29 2024, 10:51 AM
Unknown Object (File)
Sep 28 2024, 3:18 PM
Unknown Object (File)
Sep 23 2024, 4:36 PM
Subscribers

Details

Summary

Ideally, we want to force to rebase our local tree when updating against the
remote. For example, before pushing a change, I want to ensure my remote is in
sync before using git push.

Test Plan
$ make -C /usr/ports update
--------------------------------------------------------------
>>> Updating /usr/ports from git repository
--------------------------------------------------------------
cd /usr/ports; git pull --rebase origin main
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 30 (delta 5), reused 1 (delta 1), pack-reused 4
Unpacking objects: 100% (30/30), 268.98 KiB | 5.38 MiB/s, done.
From https://git.freebsd.org/ports
 * branch                      main       -> FETCH_HEAD
   7e9a1a19e813..84150d84aa58  main       -> origin/main
Successfully rebased and updated refs/heads/main.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 39441
Build 36330: arc lint + arc unit

Event Timeline

sbz requested review of this revision.May 25 2021, 7:44 AM
Makefile
192

origin main is a bit too much, what if I checkout stable/13 ?

lwhsu added a subscriber: lwhsu.

I think adding --rebase is good. We may need to check the remote and branch name because in the document we recommend set remote name as freebsd. Maybe we can use variable with default value here. (${GIT} pull --rebase ${GIT_REMOTE} ${GIT_BRANCH}).

Maybe we can get the current remote and branch using the something like, I'll test that:

GIT_REMOTE=$(git remote)
GIT_BRANCH=$(git rev-parse --symbolic-full-name @|sed 's,refs/heads/,,')

uqs requested changes to this revision.May 25 2021, 8:22 AM
uqs added inline comments.
Makefile
192

Yeah, just git pull --rebase is fine. This will pull and rebase from the tracked upstream and if people set up their ports repo in strange ways, that's up to them then.

This revision now requires changes to proceed.May 25 2021, 8:22 AM
Makefile
179

this should error out and tell people that svn is no longer updated and they need to save their local patches and clone a new tree ...

looking for svn a few lines above then might also be fully obsolete (I haven't checked the rest of the file)

185

ditto. This should tell them to use a plain git clone

We do not need to specify the current branch and remote, as pointed by @uqs by default it uses the tracked upstream

Also confirmed in the git-pull(1) man page

-r, --rebase[=false|true|merges|preserve|interactive]
	When true, rebase the current branch on top of the upstream branch
	after fetching.
sbz marked 2 inline comments as done.May 25 2021, 10:52 AM
This revision is now accepted and ready to land.May 25 2021, 11:33 AM
Makefile
179

It's good concern, but it should be threat in a different review. Also I never used git-svn, maybe we should just totally remove the svn bits as the svn repo is not updated, it's totally deprecated.

185

Same here, in another review or just remove the git+svn bits.