Another reason to love git

By John Locke on July 8, 2009

So once more, development on an internal project hit a stumbling block. The latest release of Dojo, 1.3.1, has some bug fixes I'd like to use, and in general I like to keep my main project working with the newest dojo releases. But 1.3.1 introduced a new security constraint that basically escaped all the html that I was showing in a grid control. Suddenly, instead of rich text, I get HTML markup!!!

The issue was raised a month ago, and a patch added to the Dojo trunk. But the 1.3.1 version was not patched, and the patch wasn't applied to the 1.3 branch, either. And the patch, adding a flag called "escapeHTMLInData" seems like a sensible approach, so I wanted to start coding for it. Except that the trunk of development, as the only place with the patch, had too many other changes implemented that I did not want to deal with just yet.

Git to the rescue. Git, if you don't know, is a popular source-code management tool we use at Freelock for managing all of our development, as well as keeping sites maintained.

Here's what I did to get the patch into my main codebase:

  1. git checkout -b gridEscapePatch svn/release-1.3.1  # Create a new branch called "gridEscapePatch" so I can still switch to other points without losing the patch
  2. gitk --all # pull up the entire history of Dojo, and in the search box, search for "EscapeHTML". This pulled up the commit containing the patch I wanted to apply.
  3. git cherry-pick 18f0dc99798  # Once I found the commit containing the patch, apply it to my current tree.

Done!

That's why I like using git.

I'll write a post on how we manage dojo in git as a submodule of our main projects soon, but for now if you want to clone our dojo git repository, use "git clone git://git.freelock.com/git/dojo.git" to get your own copy.

Topic

Tags

Comments

Michael (not verified)

August 25, 2009

Git sounds like a dream. Does it work in a non-programming environment? I'd like to use for a writing fiction. Does Git, or any other version control system, manage changes to binary (OO.org or Word) or rich text files?

Thanks

You can use git or svn or a variety of other tools to manage documents. Most modern (i.e. newer than CVS/RCS) version control tools can create efficient diffs of binary files, and help keep disk usage down.

However, they don't give you tools for merging changes. They are not able to unzip an OOo file, merge changes cleanly, and zip it back up--at least not yet.

For just providing you a backup history of your documents, it's great, and I highly recommend using some tool for doing this--I devoted a chapter in "Open Source Solutions for Small Business Problems" to managing documents in Subversion. But these tools don't provide the same benefits to collaborative document development as they do with collaborative development...

I could have spent hours to determine that. It sounds like you'd have to keep the content files in some sort of markup format and use a WYSIWYG editor that rendered the display separately.

Jonathan (not verified)

September 10, 2009

In reply to by Michael (not verified)

... "Lyx and LaTeX", as the rest of the world refers to it ;-)

Add new comment

The content of this field is kept private and will not be shown publicly.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <blockquote cite> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h1> <h2 id> <h3 id> <h4 id> <h5 id> <p> <br> <img src alt height width>
  • Lines and paragraphs break automatically.

Drupal Canvas — Block HTML (locked)

  • Allowed HTML tags: <strong> <em> <u> <a href> <p> <br> <ul> <ol> <li>

Drupal Canvas — Inline HTML (locked)

  • Allowed HTML tags: <strong> <em> <u> <a href>

About the Author

Profile picture for user John Locke

John Locke is the lead developer and founder of Freelock, LLC. In addition to being a proficient web developer, he is an experienced technical writer, network administrator, and all around problem solver. He has worked with computers since 1984, and currently advises small businesses on open source software.

More Like This

Laptop with coffee and pills
🕑Apr 07, 2020 🖋John Locke 💬2

Aggregate fields in Drupal 8 views

Views module has long been the killer feature of Drupal, making it easy for a site builder or skilled administrator to essentially create complex SQL queries through a web interface, without knowing SQL.

Rock climb
🕑Aug 05, 2017 🖋John Locke 💬2

Getting the group into the URL with Purl

The corners of Drupal 8 that aren't there are quickly dwindling, but there are still some that need to get worked out. While upgrading our internal issue tracker, we hit a new one -- getting a group context set via a URL alias, and generally keeping posts within a group.