public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: files/shlib/
Date: Wed,  4 Sep 2013 12:50:46 +0000 (UTC)	[thread overview]
Message-ID: <1378298846.20fefd213dead9ec0d760b0473288d3ed5d34d4e.dywi@gentoo> (raw)

commit:     20fefd213dead9ec0d760b0473288d3ed5d34d4e
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep  4 12:47:26 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep  4 12:47:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=20fefd21

files/shlib/git: git_update_config()

---
 files/shlib/git.sh | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/files/shlib/git.sh b/files/shlib/git.sh
index e68b74e..3a143d3 100644
--- a/files/shlib/git.sh
+++ b/files/shlib/git.sh
@@ -8,7 +8,9 @@
 #
 # --- functions provided by this file ---
 #
-# int git_has_changes ( [*files] ), raises die()
+# int  git_has_changes ( [*files] ), raises die()
+# void git_update_config ( config_key, [user_value], [fallback_value] ),
+#  raises die()
 #
 #
 # --- variables provided by this file ---
@@ -74,4 +76,22 @@ git_has_changes() {
    return ${has_changes}
 }
 
+# void git_update_config (
+#    config_key, [user_value], [fallback_value]
+# ), raises die()
+#
+# Sets config_key to user_value (if defined), else sets it to fallback_value
+# if config_key's value is empty/does not exist.
+#
+#
+git_update_config() {
+   if [ -n "${2-}" ]; then
+      autodie ${GIT} config "${1}" "${2}"
+   elif [ -z "${3-}" ] || ${GIT} config --get "${1}" | grep -q .; then
+      true
+   else
+      autodie ${GIT} config "${1}" "${3?}"
+   fi
+}
+
 fi # __HAVE_GIT_FUNCTIONS__


             reply	other threads:[~2013-09-04 12:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 12:50 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-14 18:24 [gentoo-commits] proj/R_overlay:master commit in: files/shlib/ André Erdmann
2013-09-23 12:34 André Erdmann
2013-09-23 12:34 André Erdmann
2013-09-06 17:27 André Erdmann
2013-09-06 10:22 André Erdmann
2013-09-04 12:50 André Erdmann
2013-09-04 12:50 André Erdmann
2013-09-04 10:16 André Erdmann
2013-08-05 11:44 André Erdmann
2013-06-30 15:58 André Erdmann
2013-06-30 15:58 André Erdmann
2013-06-22 15:24 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378298846.20fefd213dead9ec0d760b0473288d3ed5d34d4e.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox