File tree Expand file tree Collapse file tree 4 files changed +46
-9
lines changed Expand file tree Collapse file tree 4 files changed +46
-9
lines changed Original file line number Diff line number Diff line change @@ -172,14 +172,16 @@ git push --set-upstream --force origin task-123:task-123
172
172
usage: git elegant init-repository
173
173
```
174
174
175
- Creates an empty Git repository (or reinitialize an existing one) and runs its
176
- configuration.
175
+ Creates an empty Git repository (or reinitialize an existing one), runs its
176
+ configuration, and creates an initial empty commit .
177
177
178
178
Approximate commands flow is
179
179
``` bash
180
180
==>> git elegant init-repository
181
181
git init
182
182
git elegant acquire-repository
183
+ git commit --allow-empty --file a-message-of-initial-commit
184
+ git show
183
185
```
184
186
185
187
# ` obtain-work `
Original file line number Diff line number Diff line change @@ -15,19 +15,39 @@ MESSAGE
15
15
16
16
command-description () {
17
17
cat<< MESSAGE
18
- Creates an empty Git repository (or reinitialize an existing one) and runs its
19
- configuration.
18
+ Creates an empty Git repository (or reinitialize an existing one), runs its
19
+ configuration, and creates an initial empty commit .
20
20
21
21
Approximate commands flow is
22
22
\`\`\` bash
23
23
==>> git elegant init-repository
24
24
git init
25
25
git elegant acquire-repository
26
+ git commit --allow-empty --file a-message-of-initial-commit
27
+ git show
26
28
\`\`\`
27
29
MESSAGE
28
30
}
29
31
30
32
default () {
31
33
git-verbose init
32
34
git elegant acquire-repository
35
+ local message=" a-message-of-initial-commit"
36
+ cat << MESSAGE > ${message}
37
+ Add initial empty commit
38
+
39
+ This commit is the first commit in this working tree. It does not have
40
+ any changes. However, it simplifies further work at least in the
41
+ following cases:
42
+ - it's possible to create a branch now
43
+ - it's possible to manage the second commit if it requires some
44
+ polishing after creation
45
+
46
+ This commit is created automatically by Elegant Git after the
47
+ initialization of a new repository.
48
+
49
+ MESSAGE
50
+ git-verbose commit --allow-empty --file ${message}
51
+ remove-file ${message}
52
+ git-verbose show
33
53
}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ repo-new() {
12
12
perform-verbose git config --local user.email
" \" [email protected] \" "
13
13
perform-verbose git config --local user.name " \" Elegant Git\" "
14
14
perform-verbose git config --local core.editor " \" vi\" "
15
+ perform-verbose git config --local core.pager cat
15
16
perform-verbose touch ${FILE_TO_MODIFY}
16
17
perform-verbose git add .
17
18
perform-verbose git commit -m " \" Add ${FILE_TO_MODIFY} \" "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bats
2
2
3
3
load addons-common
4
- load addons-read
5
4
load addons-fake
5
+ current=$( pwd)
6
+ repository=${current} /new-repository
6
7
7
8
setup () {
8
- fake-pass " git init"
9
9
fake-pass " git elegant acquire-repository"
10
+ perform-verbose " mkdir -p ${repository} "
11
+ perform-verbose " cd ${repository} "
12
+ perform-verbose
" git config --global user.email [email protected] "
13
+ perform-verbose " git config --global user.name YourName"
14
+ perform-verbose " git config --global core.pager cat"
10
15
}
11
16
12
17
teardown () {
18
+ perform-verbose " cd ${current} "
19
+ perform-verbose " rm -rf ${repository} "
20
+ perform-verbose " git config --global --unset user.email"
21
+ perform-verbose " git config --global --unset user.name"
22
+ perform-verbose " git config --global --unset core.pager"
13
23
fake-clean
14
24
}
15
25
16
- @test " 'init-repository': command is available" {
17
- check git-elegant init-repository
18
- [ " $status " -eq 0 ]
26
+ @test " 'init-repository': creates a new repository with initial commit" {
27
+ check git-elegant init-repository
28
+ [[ ${status} -eq 0 ]]
29
+ [[ ${lines[@]} =~ " git init" ]]
30
+ [[ ${lines[@]} =~ " git commit --allow-empty" ]]
31
+ [[ ${lines[@]} =~ " git show" ]]
32
+ [[ ${lines[@]} =~ " Add initial empty commit" ]]
19
33
}
You can’t perform that action at this time.
0 commit comments