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".
This commit is contained in:
parent
6da8b42171
commit
884bb23ad3
1 changed files with 14 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue