summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLouis Burda <dev@sinitax.com>2025-10-28 22:22:15 +0100
committerLouis Burda <dev@sinitax.com>2025-10-28 22:22:15 +0100
commit64c4396bca419044bbf591077eb030df3171ebf2 (patch)
tree21d96f66f45eda175d1d64303435b02592ce9b76 /src
parente7600accd87ddb692d534519385374c1cdef1721 (diff)
downloadsubgit-64c4396bca419044bbf591077eb030df3171ebf2.tar.gz
subgit-64c4396bca419044bbf591077eb030df3171ebf2.zip
Add testcases
Diffstat (limited to 'src')
-rwxr-xr-xsrc/subgit-add1
-rwxr-xr-xsrc/subgit-check2
-rwxr-xr-xsrc/subgit-save2
-rwxr-xr-xsrc/subgit-write3
4 files changed, 6 insertions, 2 deletions
diff --git a/src/subgit-add b/src/subgit-add
index d1082f4..1411dc8 100755
--- a/src/subgit-add
+++ b/src/subgit-add
@@ -8,6 +8,7 @@ usage() {
or commit, as a subgit repo in the current path. Can also be used
to add an existing repos.
EOF
+ )
}
branch=
diff --git a/src/subgit-check b/src/subgit-check
index 5a27b0a..d86dc32 100755
--- a/src/subgit-check
+++ b/src/subgit-check
@@ -41,7 +41,7 @@ subgit-sub subrepo "$@" | while read -r subrepo; do
fi
branch=$(git -C "$bare" branch --show-current)
- if [ "${subgitinfo[$relpath/branch]}" != "$branch" ]; then
+ if [ ! -z "${subgitinfo[$relpath/branch]}" ] && [ "${subgitinfo[$relpath/branch]}" != "$branch" ]; then
echo "$relpath: new branch - '$branch'"
fi
diff --git a/src/subgit-save b/src/subgit-save
index 570d166..f2594e8 100755
--- a/src/subgit-save
+++ b/src/subgit-save
@@ -20,7 +20,7 @@ else
parent=$(dirname "$(realpath "$a")")
[ "$root" != "$(subgit-sub root "$parent")" ] \
&& die "Subgits do not have same parent"
- subrepos+=($(subgit-sub relpath "$a"))
+ subrepos+=($(subgit-sub relpath "$root" "$a"))
done
fi
diff --git a/src/subgit-write b/src/subgit-write
new file mode 100755
index 0000000..ef5aaae
--- /dev/null
+++ b/src/subgit-write
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+subgit-source genrc > "$root/.subgitrc"