Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blogposts: extract metadata from git #96

Open
rien opened this issue Oct 11, 2016 · 3 comments
Open

Blogposts: extract metadata from git #96

rien opened this issue Oct 11, 2016 · 3 comments
Assignees

Comments

@rien
Copy link
Contributor

rien commented Oct 11, 2016

For example: date created, last edited, author email & username.
This data is probably stored in the git metadata, so we don't have to fill in this information by hand.

@rien rien changed the title Blogposts: meta-data sumbission date & last edited Blogposts: extract metadata from git Oct 11, 2016
@werthen werthen added the meta label Oct 12, 2017
@JensTimmerman JensTimmerman self-assigned this Oct 12, 2020
@JensTimmerman
Copy link
Member

@JensTimmerman
Copy link
Member

fetching the
modification date of a single file is antithetical to the way git works
since git does not track per-file history. Fetching the date of a single
file is a Slow Operation because it requires scanning global history
looking for a commit in which the desired file was changed.

@JensTimmerman
Copy link
Member

JensTimmerman commented Oct 12, 2020

it's pretty easy to create more functions like the one used in #409 to get different metadata from git:

  def gitmtime
     # find file last modification time
     filepath=@item[:content_filename]
     str=`git log -1 --format=%cd --date=short -- #{filepath}`
     return Date.parse(str)
 end

e.g. to get the commiters name use --format='%cn' and to get commiters email use --format='%ce'
e.g. to get the authors name use --format='%an' and to get authors email use --format='%ae'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants