git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-remote-testgit.sh: cleaned up the logic for setting the refspec variable

From
Elia Pinto <gitter.spiros@gmail.com>
Date
May 23, 2014, 16:17 UTC
Message-ID
<1400861862-6963-1-git-send-email-gitter.spiros@gmail.com>

This patch makes the code more readable for setting the refspec variable

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 git-remote-testgit.sh |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/git-remote-testgit.sh b/git-remote-testgit.sh
index 1c006a0..fb8a003 100755
--- a/git-remote-testgit.sh
+++ b/git-remote-testgit.sh
@@ -4,18 +4,20 @@
 alias=$1
 url=$2
 
+if test -z "${GIT_REMOTE_TESTGIT_REFSPEC-notEmpty}"
+then
+	# only if it is explicitly set to an empty string...
+	prefix=refs
+else
+	prefix="refs/testgit/$alias"
+fi
 dir="$GIT_DIR/testgit/$alias"
-prefix="refs/testgit/$alias"
-
 default_refspec="refs/heads/*:${prefix}/heads/*"
-
 refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}"
-
-test -z "$refspec" && prefix="refs"
+force=
 
 export GIT_DIR="$url/.git"
 
-force=
 
 mkdir -p "$dir"
 
-- 
1.7.10.4
Message 1 of 1 in “git-remote-testgit.sh: cleaned up the logic for setting the refspec variable”
  1. git-remote-testgit.sh: cleaned up the logic for setting the refspec variableElia Pinto, May 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.