]> git.ipfire.org Git - thirdparty/git.git/commit - git-cvsimport.perl
cvsimport: cleanup commit function
authorJeff King <peff@peff.net>
Tue, 23 May 2006 07:27:46 +0000 (03:27 -0400)
committerJunio C Hamano <junkio@cox.net>
Tue, 23 May 2006 07:50:50 +0000 (00:50 -0700)
commite73aefe4fdba0d161d9878642c69b40d83a0204c
tree69697452511baadc78d5a1a97dad6f5891f7dbfe
parent6a1871e174fee1757713df7a3d776dd3813e7ad8
cvsimport: cleanup commit function

This change attempts to clean up the commit function to make it a bit
easier to read (or at least the first half of it). It also improves
robustness and performance. Specifically:
  - report get_headref errors on opening ref unless the error is ENOENT
  - use regex to check for sha1 instead of length
  - use lexically scoped filehandles which get cleaned up automagically
  - check for error on both 'print' and 'close' (since output is buffered)
  - avoid "fork, do some perl, then exec" in commit(). It's not necessary,
    and we probably end up COW'ing parts of the perl process. Plus the code
    is much smaller because we can use open2()
  - avoid calling strftime over and over (mainly a readability cleanup)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cvsimport.perl