diff options
author | Tom Willemsen | 2012-07-31 02:40:56 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-07-31 02:40:56 +0200 |
commit | 7ca2408b51b94fc2d3740cbd4bb02b368efa457c (patch) | |
tree | 786d9aea02fd6b7d9fdab149d42af77f99887658 /gitto/main.scm | |
parent | 731fba1dc41672c214d99beca6cf46f0f0c09e3e (diff) | |
download | gitto-7ca2408b51b94fc2d3740cbd4bb02b368efa457c.tar.gz gitto-7ca2408b51b94fc2d3740cbd4bb02b368efa457c.zip |
Add relative directory parsing
As of now, when using `-r' or `-R', relative directories can be used.
This *does not* include locations starting with `~', those still need
to be handled by your shell.
Because every repo is treated as a possible relative path, and thus
passed on to `realpath', the paths have become very uniform. This
means that it will now only register and unregister paths that don't
have a trailing `/'. This is not true during usage, so those paths
still work, but they can't be removed by gitto, and adding them again
will create a duplicate entry.
* gitto/Makefile (objects): Add `path.scm' and `path.go'.
(.PHONY): Add `all' as a phony target.
(all): New target, compiles all `.go' targets.
($(filter %.go,$(objects))): Use `env' to run guild so that include
paths are setup properly.
* gitto/main.scm (gitto): Use new `(gitto path)' module, it contains
the `realpath' function.
(register-repository):
(remove-repository): Always pass REPOSITORY through `realpath' and
use the result.
* gitto/path.scm: New file. Loads the `libguile-gitto-path' extension
and exports its `realpath' function.
* src/Makefile (CFLAGS):
(LDFLAGS): Use `pkg-config' to gather the necessary values for guile.
(libguile-gitto-path.so): New guile extension, wraps the `readline'
POSIX function.
* src/gitto-path.c: New file, wraps and exports the `realpath' POSIX
function from `stdlib.h'.
Diffstat (limited to 'gitto/main.scm')
-rw-r--r-- | gitto/main.scm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gitto/main.scm b/gitto/main.scm index 3a3e167..789c49e 100644 --- a/gitto/main.scm +++ b/gitto/main.scm @@ -21,6 +21,7 @@ #:use-module (ice-9 getopt-long) #:use-module (ice-9 popen) #:use-module (ice-9 rdelim) + #:use-module (gitto path) #:export (main)) (define data-dir @@ -86,6 +87,7 @@ gitto [options] (define (register-repository repository) "Register REPOSITORY in the repository list." + (set! repository (realpath repository)) (if (not (member repository repositories)) (begin (set! repositories (append `(,repository) repositories)) @@ -96,6 +98,7 @@ gitto [options] (define (remove-repository repository) "Remove/unregister REPOSITORY from the repository list." + (set! repository (realpath repository)) (if (member repository repositories) (begin (set! repositories (delete repository repositories)) |