Open
Description
I guess my post is more a question than a real issue, but here it is (worst case is, you get to see how a user of your lib for a few hours try to do) :
I am trying to define a task to get the git branch of a repository.
Here is what I have so far :
(deftask :git-branch []
(ssh (run
(cd (:path @config))
(run "pwd") ;; this println nicely /var/dev/my-repo => ok
(run "ls -a") ;; this lists the right content => ok
(run "git rev-parse --abbrev-ref HEAD") ;; master => ok
;; strangely this is listed before
;; and it fails with :
;; stderr fatal: Not a git repository (or any of the parent directories): .git
(let [rt (ssh "git rev-parse --abbrev-ref HEAD")]
(println "status " (:status rt))
(println "stdout " (:stdout rt))
(println "stderr " (:stderr rt)))
;; I am in my home repository
;; how can use `ssh` to get a result
;; while being in a repository ?
(let [rt (ssh "pwd")]
(println "status " (:status rt))
(println "stdout " (:stdout rt))
(println "stderr " (:stderr rt))))))
I am confused by the rules of the paths. I expected all calls inside cd
to have the same path. Also, how can I get the result of "git rev-parse --abbrev-ref HEAD" in the right folder ?
Metadata
Metadata
Assignees
Labels
No labels