Skip to content

Rewriting git history

Andrey Kuleshov edited this page Dec 1, 2021 · 12 revisions

Idea: remove all commits related to ktlint, create clean history only for diktat.

Checklist:

  • Create forks and archives of current repo
  • Merge all pull requests
  • Using git fast-export and git filter-repo clean history
    • Count LOC and commits to make sure everything looks reasonable
  • Change names and email of all contributors to appropriate ones
  • Reword and squash some commits
  • Force push updated repo
  • All developers should perform fresh clone

Log:

  1. Checked out 45231eddab4e968db6f19a6ad82ae96f14223385
C:\Users\a00543375\Desktop\projects>cloc.exe diKTat
     555 text files.
     487 unique files.
     492 files ignored.

http://cloc.sourceforge.net v 1.64  T=4.36 s (92.4 files/s, 4272.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Kotlin                         192           1351           1395           8370
XML                             75              0              0           3171
Javascript                       2            106            461           1091
YAML                            10             36             13           1000
Maven                            4             19              5            739
JSON                             7              0              0            425
CSS                              2             46              1            209
HTML                           108              0              0            108
Java                             1              6              8             49
Bourne Shell                     2              6              0             19
-------------------------------------------------------------------------------
SUM:                           403           1570           1883          15181
-------------------------------------------------------------------------------
   pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh$ git rev-list --all --count                                                                                            
 1104         
   pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh$ git fast-export master~99..master | (cd .. && mkdir diktat-petertrr-fresh-truncated && 
 cd diktat-petertrr-fresh-truncated && git init . && git fast-import && git checkout)                                                                                                                               
 Initialized empty Git repository in /home/pwx5333130/Documents/diktat-petertrr-fresh-truncated/.git/                                                                                
 /usr/lib/git-core/git-fast-import statistics:                                                                                                                                       
 ---------------------------------------------------------------------                                                                                                               
 Alloc'd objects:       5000                                                                                                                                                         
 Total objects:         4062 (      1556 duplicates                  )                                                                                                                     
 blobs  :         1309 (         0 duplicates        918 deltas of       1303 attempts)                                                                                              
 trees  :         2588 (      1556 duplicates        826 deltas of       2120 attempts)                                                                                              
 commits:          165 (         0 duplicates          0 deltas of          0 attempts)                                                                                              
 tags   :            0 (         0 duplicates          0 deltas of          0 attempts)                                                                                        
 Total branches:           1 (         1 loads     )                                                                                                                                       
 marks:        1048576 (      1474 unique    )                                                                                                                                       
 atoms:            569                                                                                                                                                         
 Memory total:          2446 KiB                                                                                                                                                            
 pools:          2133 KiB                                                                                                                                                          
 objects:           312 KiB                                                                                                                                                     
 ---------------------------------------------------------------------                                                                                                               
 pack_report: getpagesize()            =       4096                                                                                                                                  
 pack_report: core.packedGitWindowSize = 1073741824                                                                                                                                  
 pack_report: core.packedGitLimit      = 35184372088832                                                                                                                              
 pack_report: pack_used_ctr            =       2477                                                                                                                                  
 pack_report: pack_mmap_calls          =        112                                                                                                                                  
 pack_report: pack_open_windows        =          1 /          1                                                                                                                     
 pack_report: pack_mapped              =    2307487 /    2307487                                                                                                                     
 ---------------------------------------------------------------------                                                                                                                                                                                                                                                                                                   
   pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$ cloc *                                                                                                           
 216 text files.                                                                                                                                                                     
 206 unique files.                                                                                                                                                                    
 17 files ignored.                                                                                                                                                                                                                                                                                                                                                 
 github.com/AlDanial/cloc v 1.82  T=0.71 s (286.3 files/s, 20616.1 lines/s)                                                                                                          
 -------------------------------------------------------------------------------                                                                                                     
 Language                     files          blank        comment           code                                                                                                     
 -------------------------------------------------------------------------------                                                                                                     
 Kotlin                         180           1259           1355           7569                                                                                                     
 Markdown                         7            536              0           1727                                                                                                     
 YAML                             2             14             11            789                                                                                                     
 Maven                            4             19              5            738                                                                                                     
 JSON                             7              0              0            417                                                                                                     
 Java                             1              6              8             49                                                                                                     
 SVG                              1              0              1             43                                                                                                     
 -------------------------------------------------------------------------------                                                                                                     
 SUM:                           202           1834           1380          11332                                                                                                     
 ------------------------------------------------------------------------------- 
 pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$  git rev-list --all --count                                                                                 
 165                                                                                                               
   pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$ git filter-repo --force --invert-paths --path-regex 'ktlint(?!-ruleset-huawei).*' --path-regex 'gradle.*' --path-regex 'jitpack\.yml' 
 pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$  git rev-list --all --count                                                                                 
 162             
pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$ cat mailmap
 <andrewkuleshov7@gmail.com>                                                                                                                                        
 petertrr <peter.trifanov@mail.ru>                                                                                                                                                   
 kentr0w <qbextted0@gmail.com> Denis Kumar <deniskumar@MacBook-Pro-Denis.local>                                                                                                      
 kentr0w <qbextted0@gmail.com> kentr0w <38314854+kentr0w@users.noreply.github.com>                                                                                                   
 kentr0w <qbextted0@gmail.com> Denis Kumar <deniskumar@macbook-pro-denis.local>                                                                                                                                                                                                       

 pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$ git filter-repo --mailmap mailmap 

 pwx5333130@LAPTOP-N7OVNE0V:~/Documents/diktat-petertrr-fresh-truncated$ git shortlog -sne                                                                                               
 90  akuleshov7 <andrewkuleshov7@gmail.com>                                                                                                                                          
 52  petertrr <peter.trifanov@mail.ru>                                                                                                                                               
 18  kentr0w <qbextted0@gmail.com>                                                                                                                                                    
 1  Yegor Bugayenko <github@yegor256.com>                                                                                                                                            
 1  Yegor Bugayenko <yegor256@gmail.com>

To reword and squash commits:

 git rebase --strategy-option=theirs -i <hash of commit>
 # mark commits for squashing
 # remove all uncommented lines from commit message editor to be able to put nice message with # signs
 git commit --amend -m "Text of commit
 >
 >### What's done:
 >* Something"
 git rebase --continue

###Checks First commit:

Revision: 353fb46093c5ae4dd96c1709148496a3e6b1a44d
Author: akuleshov7 
Date: 4/20/2020 3:35:14 AM
Message:
DKT-13: [KTlint] support rule 1.3

# Rule 1.3: package name is in lower case and separated by dots, code developed internally in Huawei should start with com.huawei, and the package name is allowed to have numbers
----
Modified: gradle/wrapper/gradle-wrapper.properties
Added: ktlint-ruleset-huawei/build.gradle
Added: ktlint-ruleset-huawei/gradle.properties
Added: ktlint-ruleset-huawei/src/main/kotlin/rri.fixbot.ruleset.huawei/HuaweiRuleSetProvider.kt
Added: ktlint-ruleset-huawei/src/main/kotlin/rri.fixbot.ruleset.huawei/PackageNaming1_3.kt
Added: ktlint-ruleset-huawei/src/main/kotlin/rri/fixbot/ruleset/huawei/utils/Keywords.kt
Added: ktlint-ruleset-huawei/src/main/kotlin/rri/fixbot/ruleset/huawei/utils/StringUtils.kt
Added: ktlint-ruleset-huawei/src/main/resources/META-INF/services/com.pinterest.ktlint.core.RuleSetProvider
Deleted: ktlint-ruleset-standard/src/main/resources/META-INF/services/com.pinterest.ktlint.core.RuleSetProvider
Modified: ktlint/build.gradle
Modified: settings.gradle

Last commit

Revision: 45231eddab4e968db6f19a6ad82ae96f14223385
Author: kentr0w <qbextted0@gmail.com>
Date: 7/31/2020 3:51:41 PM
Message:
Recommendation for 3.4: statement per line (#128)

* Recommendation for 3.4: statement per line



### What's done:

  Made recommendation for 3.4 rule about number of statement per line
----
Modified: diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
Added: diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/SingleLineStatementsRule.kt
Modified: diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt
Added: diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/SequenceUtils.kt
Added: diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt
Added: diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleWarnTest.kt
Added: diktat-rules/src/test/resources/test/paragraph3/statement/StatementExpected.kt
Added: diktat-rules/src/test/resources/test/paragraph3/statement/StatementTest.kt