Skip to content

Instantly share code, notes, and snippets.

@Draiken
Created July 1, 2011 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Draiken/1058809 to your computer and use it in GitHub Desktop.
Save Draiken/1058809 to your computer and use it in GitHub Desktop.
Retrieving only one file from git
def fetch
rdm = Random.rand(2000)
file = `git clone --no-checkout --depth 1 --quiet #{repository.clone_url} /tmp/travis-yml-#{rdm} && cd /tmp/travis-yml-#{rdm} && git show HEAD:.travis.yml && rm -rf /tmp/travis-yml-#{rdm}`
file == "" ? {} : parse(file)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment