www-infrastructure-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Nalley (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (INFRA-7637) Help trimming Cayenne git repo
Date Fri, 13 Jun 2014 15:13:02 GMT

     [ https://issues.apache.org/jira/browse/INFRA-7637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

David Nalley updated INFRA-7637:

    Assignee: Gavin

> Help trimming Cayenne git repo
> ------------------------------
>                 Key: INFRA-7637
>                 URL: https://issues.apache.org/jira/browse/INFRA-7637
>             Project: Infrastructure
>          Issue Type: Task
>          Components: Git
>            Reporter: Andrus Adamchik
>            Assignee: Gavin
> Per INFRA-5936 Cayenne was migrated to Git. It was decided that we'd like to trim our
history to start with rev 38d0b4a7a72507926d3c19e6f50deb2789b4d88c (which is present in all
currently active branches and tags). I tried to do it myself using the procedure below [1],
based on a "graft" approach. This actually worked well in local tests and reduced the repo
size from 78M to more manageable 22M. However it failed when run against the real repo when
trying to delete master branch:
> $ git push origin :master
> remote: Rewinding refs/heads/master is forbidden.
> remote: 
> To https://git-wip-us.apache.org/repos/asf/cayenne.git
>  ! [remote rejected] master (pre-receive hook declined)
> I guess this is a protection against accidental "master" deletion, and it is great we
have it :) But it means we need infra help to accomplish what we are trying to do. Perhaps
a git server admin can switch the default HEAD to "master_old" on the server during the procedure,
and then switch it back to "master" when everything is done.
> [1] suggested procedure:
> git clone ...
> cd cayenne/
> git checkout -b master origin/master
> git checkout -b STABLE-3.0 origin/STABLE-3.0
> git checkout -b STABLE-3.1 origin/STABLE-3.1
> # rename main branches
> git branch -m master master_old
> git branch -m STABLE-3.0 STABLE-3.0_old
> git branch -m STABLE-3.1 STABLE-3.1_old
> # save clones of main branches... just in case...
> git push origin master_old
> git push origin STABLE-3.1_old
> git push origin STABLE-3.0_old
> # delete remote branches
> git push origin :STABLE-3.0
> git push origin :STABLE-3.1
> git push origin :master
> # now delete local repo and clone again ... otherwise git filter-branch  would get stuck

> git clone file:///Users/cayenne/work/tmp/cayenne 
> cd cayenne/
> git checkout --orphan temp 38d0b4a7a72507926d3c19e6f50deb2789b4d88c
> git commit -m "Truncated root"
> # create new versions of the main branches
> git checkout -b master master_old
> git checkout -b STABLE-3.0 origin/STABLE-3.0_old
> git checkout -b STABLE-3.1 origin/STABLE-3.1_old
> # the second rev is the rev just committed on the temp branch
> echo "ad075710ba06ffc043f01b808d519882fa063ed9 <rev>" > .git/info/grafts
> git filter-branch --tag-name-filter cat -- --all
> git branch -D temp
> rm .git/info/grafts # important ... push doesn't work with graft around
> # push new branches
> git push origin master
> git push origin STABLE-3.1
> git push origin STABLE-3.0
> git push origin :STABLE-3.0_old
> git push origin :STABLE-3.1_old
> git push origin :master_old

This message was sent by Atlassian JIRA

View raw message