Git/log

From Freephile Wiki
< Git
Revision as of 00:22, 19 August 2025 by Admin (talk | contribs)

We use git log for creating RELEASE NOTES


For example:


git log --pretty feature-kibana..HEAD

commit 7bc8622d5fa46f7cbfb001b45c04fcdb4d55ed0c (HEAD -> qb-1.43, tag: 43.4.7, origin/qb-1.43)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Fri Jan 24 02:18:59 2025 +0000

    Finish off Maintenance Script improvements
    
    Last commits for this round of maintenance script operations
    Fixes Issue #142

commit 7cb9091831caf8a3f72d9c8de44310f5c9e1ad9e (tag: 43.7.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Fri Jan 24 02:12:42 2025 +0000

    Add comments for $smwgParserFeatures (Links In Values feature)

commit ab10ebe10fa294f4a8ce456269107281f2e2de18
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Fri Jan 17 19:08:51 2025 +0000

    Maintenance Script update (missed these)
    
    Convert script calls to go through executable
    'maintenance/run'
    For extensions, use the class naming pattern
    'Extension:ClassName'
    Fixes Issue #142

commit ca1791040ebf7ea5e7ff4cef04f6c3ef2d56f2d2 (tag: 43.4.6)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Fri Jan 17 19:01:19 2025 +0000

    Finish Maintenance Script update
    
    Convert script calls to go through executable
    'maintenance/run'
    For extensions, use the class naming pattern
    'Extension:ClassName'
    Fixes Issue #142

commit d624f7b4fbed42033dd8b6da3e786f9c1de53340 (tag: 43.6.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:48:54 2025 +0000

    A new tool to inspect the git repos on the controller

commit e267f14854957206ba556812038c357e27db0116 (tag: 43.4.5)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:48:12 2025 +0000

    Update the Update.php role for new Maintenance script ops
    
    Issue #142

commit 9e4de5e18ad148ff47660c6c22b5dbf6ace5c940 (tag: 43.4.4)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:46:57 2025 +0000

    Update maintenance scripts
    
    Server Performance logging/reporting role
    (Probably needs to be eliminated altogether)
    Issue #142

commit 278c394ee70a00d86abcf13f434f6677723436b6 (tag: 43.4.3)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:45:38 2025 +0000

    Update maintenance scripts
    
    showSiteStats and refreshLinks
    Issue #142

commit 57c9bb20231e76fed948d22ea93714cff24d53c6 (tag: 43.4.2)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:44:01 2025 +0000

    Disable metastore maintenance
    
    All maintenance needs to be refactored
    Issue #142
    Also, this may be affected by upgrading to SMW 5.x
    Issue #136

commit 7ad66760bc98bfdf95f7774ad920c669510ca784 (tag: 43.5.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:42:08 2025 +0000

    Prefer source in composer managed extensions
    
    Use the --prefer-source option to composer
    Eliminate the duplicate composer run
    Eliminate the removal of a non-existant SMW file (IdeAliases.php)
    needed for Issue #136

commit f87b92b261035b4e8f91a169ecf9b286303de61c (tag: 43.4.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 23:32:29 2025 +0000

    Update maintenance scripts for MediaWiki 1.40
    
    Fixes Issue #142

commit 4ca775d65b3f64907dd87990af28073d454702fa (tag: 43.3.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Thu Jan 16 22:56:48 2025 +0000

    Update MezaCoreExtensions.yml for REL1_43
    
    Use full enableSemantics() call to fix URL pattern
    Switch to gerrit because GitHub seems to throttle
    SemanticDrilldown 3.05 -> dev-master
    SemanticScribunto 2.2.0 -> dev-master
    add quotes on SemanticDrilldown version spec
    add quotes on SubPageList version spec

commit e2873948a30a02fb56a8be6d40181f76101fad1c (tag: 43.2.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Fri Jan 10 17:45:00 2025 +0000

    Create a variable named php_memory_limit defaulting to 128M
    
    PHP normally defaults to 128M so we also default to that.
    Templated in the php.ini template of the apache-php role.
    Fixes issue #151

commit 51c89233b3279fbdd76c371cbdd5f9b17552d614 (tag: 43.1.2)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Wed Jan 8 01:39:19 2025 +0000

    Enable SemanticCompoundQueries
    
    Was 2.2.0
    Now 3.x-dev (same as dev-master)
    Issue #140

commit d2a87e79e3f039f7c81cc2ca091959698a11d99c (tag: 43.1.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Wed Jan 8 00:43:17 2025 +0000

    Use SubPageList dev-master
    
    Fixes issue #138

commit ca17aac64a4c1cd83be7ea4f22ac6b2732bdce06 (tag: 43.0.3)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Tue Jan 7 21:38:15 2025 +0000

    Disable or update non-working skins
    
    These skins need a version adjustment or update
    to work with REL1_43
    - Tweeki
    - Medik
    
    Use tags/v4.39.1 for Tweeki
    Issue #136

commit cde7d8cfaa866bbcba6de5b32b34f1d94b1134e6 (tag: 43.0.2)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Tue Jan 7 21:09:29 2025 +0000

    Disable non-working extensions
    
    These extensions do not work, or need a version adjustment,
    to be compatible with REL1_43 and SMW 5.x
    - SemanticCompoundQueries
    - SemanticDependencyUpdater
    - SemanticDrilldown
    - SemanticExtraSpecialProperties
    - SemanticResultFormats
    - SemanticScribunto
    - SubPageList

commit 36567d8330bef1a28d923fd0f351f7ef6e26bdd8 (tag: 43.0.1)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Tue Jan 7 21:04:38 2025 +0000

    Switch SMW to dev-master
    
    Addresses Issue #137
    composer show -a mediawiki/semantic-media-wiki
    shows all available composer versions

commit d7d6a88ecebedf8eb2a2d476d26d937696ba2809 (tag: 43.0.0)
Author: Greg Rundlett <greg.rundlett@gmail.com>
Date:   Tue Jan 7 17:33:33 2025 +0000

    Upgrade to REL1_43
    
    Fixes Issue #136
    set meza_repository_url to use freephile/meza
    set mediawiki_version for core
    set mediawiki_default_branch (for extensions)
    set php_ius_version to php81


Pretty[edit]

'pretty' is shorthand for various formats that are predefined.

  • git log --pretty=oneline
  • git log --pretty=short
  • git log --pretty=medium
  • git log --pretty=full
  • git log --pretty=fuller
  • git log --pretty=reference
  • git log --pretty=email
  • git log --pretty=raw
  • git log --pretty=format:<string> and git log --pretty=tformat:<string>

When the format name is not recognized (ie. none of the above), and has %placeholder in it, it acts as if --pretty=tformat:<format> were given. This is all to say the --pretty= and --format= are nearly identical ways of saying the same thing.


Commit Formatting[edit]

The format parameter to git log allows you to specify exactly what you want to see in the output.

--pretty=format: is equivalent to --format=


git log -3 --pretty=format:"* %h - %an: %s" 39.5.0...HEAD gives output like this:

* 43be9737 - Greg Rundlett: Make wiki config directory group executable
* 45658c32 - Greg Rundlett: fix quoting in SMW setupStore shell command
* 8a5fde26 - Greg Rundlett: Add Admin rights for SMW

Show the date in 'short' format -in other words YYYY-MM-DD - with %as
git log -3 --pretty=format:"* %h (%as) - %an: %s" 39.5.0...HEAD

* 43be9737 (2025-08-17) - Greg Rundlett: Make wiki config directory group executable
* 45658c32 (2025-08-17) - Greg Rundlett: fix quoting in SMW setupStore shell command
* 8a5fde26 (2025-08-16) - Greg Rundlett: Add Admin rights for SMW


Add in ref names (tags / branches) with %d
git log -3 --pretty=format:"* %h (%as) %d - %an: %s" 39.5.0...HEAD

* 43be9737 (2025-08-17)  (HEAD -> main, tag: 43.25.11, origin/main, origin/HEAD) - Greg Rundlett: Make wiki config directory group executable
* 45658c32 (2025-08-17)  (tag: 43.25.10) - Greg Rundlett: fix quoting in SMW setupStore shell command
* 8a5fde26 (2025-08-16)  (tag: 43.25.9) - Greg Rundlett: Add Admin rights for SMW

Instead of the default decorations for ref names you get with a simple %d, you can supply your own. Here we prefix tags with v and no space instead of the default 'tag: ' seen above. To use long-hand decoration, you specify %(decorate:) along with four specifications for the prefix, suffix, tag and separator. E.g.
git log -3 --pretty=format:"* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s" 39.5.0...HEAD

* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable
* 45658c32 (2025-08-17) v43.25.10 - Greg Rundlett: fix quoting in SMW setupStore shell command
* 8a5fde26 (2025-08-16) v43.25.9 - Greg Rundlett: Add Admin rights for SMW

Just like '%s' shows the subject, %b shows the body of the commit message in the log.
git log -3 --pretty=format:"* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s %b" 39.5.0...HEAD

* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable Not sure this should be apache owned, but if meza-ansible
user is going to have any permission to do anything here
then it needs to be group executable

* 45658c32 (2025-08-17) v43.25.10 - Greg Rundlett: fix quoting in SMW setupStore shell command 
* 8a5fde26 (2025-08-16) v43.25.9 - Greg Rundlett: Add Admin rights for SMW Allow access to Special:SemanticMediaWiki for Sysops group.

tformat works just like format with the benefit of adding a terminating newline character after the final output.
git log -3 --pretty=tformat:"* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s %b" 39.5.0...HEAD

same output as above, with a newline after the final item

You also get tformat behavior if you do not specify any 'format' word, but use '%-encoded' formatting strings. Thus, the following is equivalent to the previous example:
git log -3 --pretty="* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s %b" 39.5.0...HEAD