Ticket #27485 (new enhancement)
make "port sync" git - aware
| Reported by: | andy@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | base | Version: | 1.9.2 |
| Keywords: | git, subversion, sync, haspatch | Cc: | ecronin@…, jeremyhu@…, nonstop.server@…, michael.klein@…, egall@… |
| Port: |
Description
please let "port sync" detect a ".git"-macports repo instead of a subversion repository.
patch attached.
Attachments
Change History
comment:1 Changed 2 years ago by ecronin@…
I just switched to a local git-svn repo and would like to see this too...
Attaching a new patch that adds a couple more features:
- checking for $portdir/../.git is brittle, a better check is to run cd $portdir && git rev-parse --is-inside-work-tree 2>/dev/null >/dev/null which doesn't depend on a particular layout of the repository
- the 'update' command is different for raw git versus git-svn so check which type the working-dir is and use the right one
comment:2 Changed 2 years ago by ecronin@…
This needs some more work to match the behavior of svn. git pull and git svn fetch only bring the remote changes to the local repo, they don't apply them to the working copy for MacPorts to see... A git rebase or git svn rebase is also needed, likely surrounded by a git stash save/git stash pop combo and some error checking to clean up a failed merge...
Right now this patch is a slightly fancy NOOP from port sync's standpoint since the working tree doesn't change and no new updates get indexed.
Changed 22 months ago by ecronin@…
- Attachment gitsync.2.patch added
updated patch to rebase git-svn repos
comment:3 Changed 19 months ago by ecronin@…
- Keywords sync, haspatch added; sync removed
- Cc ecronin@… added
The change to .svn detection recently committed stopped my previous patch from applying cleanly, here's a new version which always includes the git stash save/pop step (I was incorrect in comment 3 I believe, a pull does a merge which should update the working directory)
I only test the git-svn half of the patch, but it has worked fine for 10 months now, blowing up a bit when manual intervention is needed because rebase or git stash pop has conflicts (I assume a failed svn update has the same issues on a dirty working directory), fixing the conflict and running selfupdate again is all that's needed
Changed 19 months ago by ecronin@…
- Attachment 0001-Add-support-for-git-managed-portdirs.patch added
comment:4 Changed 13 months ago by ecronin@…
- Cc jeremyhu@… added
r92410 does this for clean git repos, doesn't look like it handles git-svn or stashing any local modifications before trying to rebase
comment:7 Changed 7 months ago by michael.klein@…
I have two concerns regarding r92410:
- it only works if $portdir is the repository root directory, so it doesn't even work for git://git.macports.org/macports/trunk.git, where $portdir is in dports
- it does a git pull --rebase. See http://git-scm.com/book/ch3-6.html#The-Perils-of-Rebasing how this can cause trouble. If one really wants to rebase, one can use git config --local pull.rebase true instead
So, can we have 0001-Add-support-for-git-managed-portdirs.patch applied instead, but without git stash save/pop? If there are no local modifications, git stash save doesn't seem to save anything, and the following git stash pop fails. IMO is't perfectly ok to have the user commit any modifications before syncing.
Changed 7 months ago by michael.klein@…
- Attachment 0001-Add-support-for-git-managed-portdirs2.patch added

