diff options
author | Tom Willemsen | 2012-07-01 20:47:45 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-07-01 20:47:45 +0200 |
commit | 884bb23ad348bd5a033073adf3d9ea52f29894ba (patch) | |
tree | f35edc299670c3a703d1cbba3a988781d927e4ca | |
parent | 6da8b421710503949ace55a83ff66649a2578f5c (diff) | |
download | gitto-884bb23ad348bd5a033073adf3d9ea52f29894ba.tar.gz gitto-884bb23ad348bd5a033073adf3d9ea52f29894ba.zip |
Handle brand-new repositories better
stderr from the underlying git process was not being
redirected/ignored properly, now somewhat more. If EOF is encountered
when asking for the last update date it is shown as "never".
-rw-r--r-- | gitto/main.scm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gitto/main.scm b/gitto/main.scm index 8545630..1699118 100644 --- a/gitto/main.scm +++ b/gitto/main.scm @@ -80,28 +80,33 @@ gitto [options] (newline)) (define (git-revs-to-push) - (let* ((pp (open-input-pipe "git log --pretty=oneline @{u}.. | wc -l")) - (num (string->number (read-line pp)))) - (close-pipe pp) + (let* ((pipe (open-input-pipe + "git log --pretty=oneline @{u}.. 2>/dev/null | wc -l")) + (num (string->number (read-line pipe)))) + (close-pipe pipe) num)) (define (git-revs-to-pull) - (let* ((pp (open-input-pipe "git log --pretty=oneline ..@{u} | wc -l")) - (num (string->number (read-line pp)))) - (close-pipe pp) + (let* ((pipe (open-input-pipe + "git log --pretty=oneline ..@{u} 2>/dev/null | wc -l")) + (num (string->number (read-line pipe)))) + (close-pipe pipe) num)) (define (git-clean?) - (let* ((pipe (open-input-pipe "git status -suno")) + (let* ((pipe (open-input-pipe "git status -suno 2>/dev/null")) (clean? (eof-object? (read-delimited "" pipe)))) (close-pipe pipe) clean?)) (define (git-last-update) - (let* ((pipe (open-input-pipe "git log -1 --format=%ar @{u}")) + (let* ((pipe (open-input-pipe + "git log -1 --format=%ar @{u} 2>/dev/null")) (relative-last-update (read-line pipe))) (close-pipe pipe) - relative-last-update)) + (if (eof-object? relative-last-update) + "never" + relative-last-update))) (define (list-repositories) (for-each |