Skip to content

Commit 712b4ac

Browse files
authored
Merge pull request #232 from achilleas-k/commit-empty-direct-fix
small PR, large impact
2 parents 17734d7 + fba6c7d commit 712b4ac

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

.travis.yml

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: go
22

3-
dist: trusty
4-
sudo: required
3+
dist: xenial
54

65
services:
76
- docker
@@ -16,9 +15,6 @@ matrix:
1615
allow_failures:
1716
- go: tip
1817

19-
before_install:
20-
- sudo apt-get update
21-
2218
install:
2319
# tools
2420
- go get github.com/golang/lint/golint
@@ -52,13 +48,3 @@ script:
5248
while ! curl localhost:3000 -so /dev/null; do sleep 1; done;
5349
./tests/${testscript};
5450
fi
55-
56-
after_script:
57-
# push logs to gist
58-
- if [[ "${TRAVIS_GO_VERSION}" != "tip" ]]; then
59-
echo $GISTTOKEN > ./tests/testuserhome/.gist;
60-
mv ./tests/testuserhome/log/gin.log ./tests/testuserhome/log/gin-${TRAVIS_BRANCH}-${testscript}.log;
61-
mv ./tests/testuserhome/log/tests.log ./tests/testuserhome/log/tests-${TRAVIS_BRANCH}-${testscript}.log;
62-
./tests/run-cont find ./log -type f -exec gist -u 59e3b1c2fc3ff525127f9b3af81e7f4c {} \+ ;
63-
rm ./tests/testuserhome/.gist;
64-
fi

git/git.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (s RepoFileStatus) MarshalJSON() ([]byte, error) {
7878
}
7979
return json.Marshal(struct {
8080
RFSAlias
81-
Err string
81+
Err string `json:"err"`
8282
}{
8383
RFSAlias: RFSAlias(s),
8484
Err: errmsg,
@@ -516,9 +516,17 @@ func Commit(commitmsg string) error {
516516

517517
// CommitEmpty performs a commit even when there are no new changes added to the index.
518518
// This is useful for initialising new repositories with a usable HEAD.
519-
// (git commit --allow-empty)
519+
// In indirect mode (non-bare repositories) simply uses git commit with the '--allow-empty' flag.
520+
// In direct mode it uses git-annex sync.
521+
// (git commit --allow-empty or git annex sync --commit)
520522
func CommitEmpty(commitmsg string) error {
521-
cmd := Command("commit", "--allow-empty", fmt.Sprintf("--message=%s", commitmsg))
523+
msgarg := fmt.Sprintf("--message=%s", commitmsg)
524+
var cmd shell.Cmd
525+
if !IsDirect() {
526+
cmd = Command("commit", "--allow-empty", msgarg)
527+
} else {
528+
cmd = AnnexCommand("sync", "--commit", msgarg)
529+
}
522530
stdout, stderr, err := cmd.OutputError()
523531
if err != nil {
524532
log.Write("Error during CommitEmpty")

version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.4
1+
version=1.5dev

0 commit comments

Comments
 (0)