Skip to content

Commit 5e35284

Browse files
committedDec 5, 2011
Rename vcsh seed-gitignore to vcsh write-gitignore
1 parent c1ec333 commit 5e35284

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed
 

‎_vcsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ _arguments \
1212
list-tracked-by\:"list files tracked by a repo"
1313
rename\:"rename repo"
1414
run\:"run command on repo"
15-
seed-gitignore\:"seed .gitignore.d/foo from git ls-files"
1615
setup\:"set up repo with recommended settings"
16+
write-gitignore\:"write .gitignore.d/foo via git ls-files"
1717
\<REPO\>\:"Run git command directly"
1818
))'

‎doc/vcsh.1.ronn

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ vcsh(1) - manage and sync config files via git
2323

2424
`vcsh` run <repo> <command>
2525

26-
`vcsh` seed-gitignore <repo>
27-
2826
`vcsh` setup <repo>
2927

28+
`vcsh` write-gitignore <repo>
29+
3030
`vcsh` <repo> <gitcommand>
3131

3232
`vcsh` <repo>
@@ -94,12 +94,12 @@ an interactive user.
9494
This is needed to support mr and other scripts properly and of no concern to
9595
an interactive user.
9696

97-
* seed-gitignore:
98-
Seed .gitignore.d/<repo> from git ls-files.
99-
10097
* setup:
10198
Set up repository with recommended settings.
10299

100+
* write-gitignore:
101+
Write .gitignore.d/<repo> via git ls-files.
102+
103103
* <repo> <gitcommand>:
104104
Shortcut to run `vcsh` on a repo. Will prepend `git` to <command> by itself.
105105

‎vcsh

+21-21
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ help() {
2323
<newname> Rename repository
2424
run <repo> \\
2525
<command> Use this repository
26-
27-
seed-gitignore \\
28-
<repo> Seed .gitignore.d/<repo> from git ls-files
2926
setup Set up repository with recommended settings
27+
write-gitignore \\
28+
<repo> Write .gitignore.d/<repo> via git ls-files
3029
3130
<repo> <git command> Special command that allows you to run git commands
3231
directly without having to type so much ;)" >&2
32+
<repo> Special command that enters a repository
3333
}
3434

3535
debug() {
@@ -141,7 +141,21 @@ run() {
141141
$VCSH_EXTERNAL_COMMAND
142142
}
143143

144-
seed_gitignore() {
144+
setup() {
145+
use
146+
git config core.worktree "$GIT_WORK_TREE"
147+
git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
148+
git config vcsh.vcsh 'true'
149+
[ -e "$HOME/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$HOME/.gitignore.d/$VCSH_REPO_NAME"
150+
}
151+
152+
use() {
153+
git_dir_exists
154+
export GIT_WORK_TREE="$(git config --get core.worktree)"
155+
export VCSH_DIRECTORY="$VCSH_REPO_NAME"
156+
}
157+
158+
write_gitignore() {
145159
use
146160
cd "$HOME" || fatal "could not enter '$HOME'" 11
147161
gitignores=$(for file in $(git ls-files); do
@@ -170,20 +184,6 @@ seed_gitignore() {
170184
fatal "could not move '$tempfile' to '$HOME/.gitignore.d/$VCSH_REPO_NAME'" 53
171185
}
172186

173-
setup() {
174-
use
175-
git config core.worktree "$GIT_WORK_TREE"
176-
git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
177-
git config vcsh.vcsh 'true'
178-
[ -e "$HOME/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$HOME/.gitignore.d/$VCSH_REPO_NAME"
179-
}
180-
181-
use() {
182-
git_dir_exists
183-
export GIT_WORK_TREE="$(git config --get core.worktree)"
184-
export VCSH_DIRECTORY="$VCSH_REPO_NAME"
185-
}
186-
187187
if [ "$1" = 'clone' ]; then
188188
[ -z $2 ] && fatal "$1: please specify a remote" 1
189189
export VCSH_COMMAND="$1"
@@ -197,8 +197,8 @@ elif [ "$1" = 'delete' ] ||
197197
[ "$1" = 'list-tracked-by' ] ||
198198
[ "$1" = 'rename' ] ||
199199
[ "$1" = 'run' ] ||
200-
[ "$1" = 'seed-gitignore' ] ||
201-
[ "$1" = 'setup' ]; then
200+
[ "$1" = 'setup' ] ||
201+
[ "$1" = 'write-gitignore' ]; then
202202
[ -z $2 ] && fatal "$1: please specify repository to work on" 1
203203
[ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
204204
[ "$1" = 'run' -a -z "$3" ] && fatal "$1: please specify a command" 1
@@ -207,7 +207,7 @@ elif [ "$1" = 'delete' ] ||
207207
export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
208208
[ "$VCSH_COMMAND" = 'rename' ] && export GIT_DIR_NEW="$VCSH_BASE/$3.git"
209209
[ "$VCSH_COMMAND" = 'run' ] && shift 2 && export VCSH_EXTERNAL_COMMAND="$*"
210-
[ "$VCSH_COMMAND" = 'seed-gitignore' ]
210+
[ "$VCSH_COMMAND" = 'write-gitignore' ]
211211
elif [ "$1" = 'list' ] ||
212212
[ "$1" = 'list-tracked' ]; then
213213
export VCSH_COMMAND="$1"

0 commit comments

Comments
 (0)
Please sign in to comment.