Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 988107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:35:31+00:00 2026-05-16T05:35:31+00:00

I’m working on a simple CMS (based on Django, not that it matters) similar

  • 0

I’m working on a simple CMS (based on Django, not that it matters) similar to Jekyll and Hyde, but dynamic instead of static. The idea is that the server has a copy of the repository, I can push stuff into that, and the CMS will automatically pick up the new content.

Let’s say that Markdown-formatted blog posts in my repository follow this file naming scheme:

/blog/2010/08/14/my-blog-post.md

Internally, the processed files will be cached in a SQLite database under a unique ID, for easy searching and fast serving.

The problem is in constructing the URLs in such a way that they can be mapped to files in the repository. I see several options:

  1. /blog/2010/08/14/my-blog-post
    If I simply map (part of) the URL to a filename, renaming a file will break all links pointing to that file. The content admin can leave a symlink in place of the old file, which the CMS can map into a HTTP redirect, but this requires work that is easy to forget.

  2. /blog/2010/08/14/271-my-blog-post
    If I include a database ID in every URL, clearing or rebuilding the cache will invalidate all IDs, which is even worse. I would like the git repository to be the only thing representing the site’s contents; everything else should be reconstructible from that.

  3. /blog/2010/08/14/528dc05-my-blog-post
    The only thing uniquely identifying a file in the repo over time, as far as I can tell, is a pair (filename, SHA1). That file is guaranteed to exist in that commit, and we can trace it to the current HEAD through the git log.
    (I won’t include the full SHA1, but just enough to make collisions sufficiently unlikely. Will do the math later.)

My question is twofold:

  • Is there an easy and fast way in git to track a (filename, SHA1) pair through renames to the corresponding filename in the current HEAD?

  • Is there a better way to accomplish my goals: not breaking existing URLs, but still allowing for renames and cache rebuilds?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:35:31+00:00Added an answer on May 16, 2026 at 5:35 am

    Easy/fast? Not sure, but I don’t think so. Git tracks the contents of files as blobs. The filenames of those blobs are then stored in tree objects. Then, commits point to tree objects, and add some metadata like committer, datetime, and a parent commit.

    I don’t think Git actually stores renames as such, it’s merely a difference between trees pointing to the same blobs.

    I think the best you can do is to have /path/to/file as URLs, and when you don’t find that file in HEAD, iteratively scan backwards in the history to find the commit where there was one.

    If you’re going to be doing this kind of repository level stuff, I recommend you pick up a copy of Peepcode’s Git Internals, which quite clearly explains the inner workings of a git repository.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.