summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2021-01-29 14:55:24 +0100
committerRobert Günzler <r@gnzler.io>2021-01-29 14:55:24 +0100
commitef2e08b2b9eead9119f916464182fca652ef3fef (patch)
tree20c769747dda7400458df4627b49bfb83ebd921e
parentdc9537632380d8f31d6e89efd8518064bf1c4302 (diff)
git: fix credential impls and error out when missing arg on pr alias
-rw-r--r--.config/git/config8
1 files changed, 4 insertions, 4 deletions
diff --git a/.config/git/config b/.config/git/config
index 631a82a..5370deb 100644
--- a/.config/git/config
+++ b/.config/git/config
@@ -18,15 +18,15 @@
 
 [credential "git.sr.ht"]
     username = robertgzr
-    helper = !sh -c 'pass sr.ht/robertgzr | xargs printf "password=%s\n"'
+    helper = !sh -c 'pass sr.ht/robertgzr | head -n1 | xargs printf "password=%s\n"'
 
 [credential "github.com"]
     username = robertgzr
-    helper = !sh -c 'pass github.com/robertgzr | xargs printf "password=%s\n"'
+    helper = !sh -c 'pass github.com/robertgzr | head -n1 | xargs printf "password=%s\n"'
 
 [credential "smtp://mail.gandi.net:465"]
     username = robert@gnzler.io
-    helper = !sh -c 'pass email/gnzler.io | xargs printf "password=%s\n"'
+    helper = !sh -c 'pass email/gnzler.io | head -n1 | xargs printf "password=%s\n"'
 
 [core]
     excludesfile = ~/.git/ignore
@@ -87,7 +87,7 @@
     log-since = "!sh -c \"git log --since '${1:-1} days ago' --oneline --author $(git config user.email)\" -"
     # usage: pr <num> [<remote>]
     # creates local branch pr/<num> from origin or <remote> and checks it out
-    pr = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
+    pr = "!f() { git fetch -fu ${2:-origin} refs/pull/${1:?missing pr num}/head:pr/$1 && git checkout pr/$1; }; f"
     total-lines = "! git ls-tree -r master --name-only | xargs -I {} git blame --line-porcelain {} | sed -n 's/^author //p' | sort | uniq -c | sort -rn"
     fixup = "!f() { git commit --fixup=${1}; }; f"
     squash = "!f() { git commit --squash=${1}; }; f"