Skip to content

Commit 96f9a86

Browse files
authored
Merge branch 'master' into master
2 parents 091b082 + 1f09bbc commit 96f9a86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+68
-34
lines changed

COMPILING.md

+7-9

Makefile

+5-8
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ ZSH_COMP_INSTALL_DIR=$(DESTDIR)/usr/share/zsh/site-functions
66
BASH_COMP_INSTALL_DIR=$(DESTDIR)/etc/bash_completion.d
77

88
# other vars
9-
VER=$(shell grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" src/github.com/oniony/TMSU/version/version.go)
9+
VER=$(shell grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" version/version.go)
1010
SHELL=/bin/sh
1111
ARCH=$(shell uname -m)
1212
DIST_NAME=tmsu-$(ARCH)-$(VER)
1313
DIST_DIR=$(DIST_NAME)
1414
DIST_FILE=$(DIST_NAME).tgz
1515

16-
export GOPATH ?= /usr/lib/go:/usr/share/gocode
17-
export GOPATH := $(CURDIR):$(GOPATH)
18-
1916
all: clean compile dist test
2017

2118
clean:
2219
@echo
2320
@echo "CLEANING"
2421
@echo
25-
go clean github.com/oniony/TMSU
22+
go clean
2623
rm -Rf bin
2724
rm -Rf $(DIST_DIR)
2825
rm -f $(DIST_FILE)
@@ -32,15 +29,15 @@ compile:
3229
@echo "COMPILING"
3330
@echo
3431
@mkdir -p bin
35-
go build -o bin/tmsu github.com/oniony/TMSU
32+
go build -o bin/tmsu
3633

3734
test: unit-test integration-test
3835

3936
unit-test: compile
4037
@echo
4138
@echo "RUNNING UNIT TESTS"
4239
@echo
43-
go test github.com/oniony/TMSU/...
40+
go test ./...
4441

4542
integration-test: compile
4643
@echo
@@ -66,7 +63,7 @@ dist: compile
6663
cp misc/bash/tmsu -t $(DIST_DIR)/misc/bash/
6764
tar czf $(DIST_FILE) $(DIST_DIR)
6865

69-
install:
66+
install:
7067
@echo
7168
@echo "INSTALLING"
7269
@echo

README.md

+3
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/github.com/oniony/TMSU/cli/mount.go cli/mount.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ var MountCommand = Command{
3333
Name: "mount",
3434
Synopsis: "Mount the virtual filesystem",
3535
Usages: []string{"tmsu mount",
36-
"tmsu mount [OPTION]... [FILE] MOUNTPOINT"},
36+
"tmsu mount [OPTION]... MOUNTPOINT"},
3737
Description: `Without arguments, lists the currently mounted file-systems, otherwise mounts a virtual file-system at the path MOUNTPOINT.
3838
39-
Where FILE is specified, the database at FILE is mounted.
39+
Use the --database global option or TMSU_DB environment variable (in order of precedence) to specify the path of the database to be mounted.
4040
41-
If FILE is not specified but the TMSU_DB environment variable is defined then the database at TMSU_DB is mounted.
41+
Where neither --database is specified nor TMSU_DB defined then the default database is mounted.
4242
43-
Where neither FILE is specified nor TMSU_DB defined then the default database is mounted.
43+
To allow other users access to the mounted filesystem, pass the 'allow_other' FUSE option, e.g. 'tmsu mount --options=allow_other mp'. (FUSE only allows the root user to use this option unless 'user_allow_other' is present in '/etc/fuse.conf'.)
4444
45-
To allow other users access to the mounted filesystem, pass the 'allow_other' FUSE option, e.g. 'tmsu mount --options=allow_other mp'. (FUSE only allows the root user to use this option unless 'user_allow_other' is present in '/etc/fuse.conf'.)`,
45+
For further documentation on the usage of the --database option, refer to 'tmsu help', without specifying a subcommand`,
4646
Examples: []string{"$ tmsu mount mp",
47-
"$ tmsu mount /tmp/db mp",
47+
"$ tmsu mount --database=/tmp/db mp",
4848
"$ tmsu mount --options=allow_other mp"},
4949
Options: Options{Option{"--options", "-o", "mount options (passed to fusermount)", true, ""}},
5050
Exec: mountExec,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/github.com/oniony/TMSU/cli/values.go cli/values.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ func listValuesForTag(store *storage.Storage, tx *storage.Tx, tagName string, sh
131131
} else {
132132
if onePerLine {
133133
for _, value := range values {
134-
fmt.Println(escape(value.Name, '=', ' '))
134+
fmt.Println(escape(value.Name, ' '))
135135
}
136136
} else {
137137
valueNames := make([]string, len(values))
138138
for index, value := range values {
139-
valueNames[index] = escape(value.Name, '=', ' ')
139+
valueNames[index] = escape(value.Name, ' ')
140140
}
141141

142142
terminal.PrintColumns(valueNames)
@@ -172,13 +172,13 @@ func listValuesForTags(store *storage.Storage, tx *storage.Tx, tagNames []string
172172
if onePerLine {
173173
fmt.Println(tagName)
174174
for _, value := range values {
175-
fmt.Println(escape(value.Name, '=', ' '))
175+
fmt.Println(escape(value.Name, ' '))
176176
}
177177
fmt.Println()
178178
} else {
179179
valueNames := make([]string, len(values))
180180
for index, value := range values {
181-
valueNames[index] = escape(value.Name, '=', ' ')
181+
valueNames[index] = escape(value.Name, ' ')
182182
}
183183

184184
fmt.Printf("%v: %v\n", tagName, strings.Join(valueNames, " "))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

go.mod

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/oniony/TMSU
2+
3+
go 1.16
4+
5+
require (
6+
github.com/hanwen/go-fuse v1.0.0
7+
github.com/mattn/go-sqlite3 v1.14.7
8+
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
9+
)

go.sum

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
github.com/hanwen/go-fuse v1.0.0 h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=
2+
github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok=
3+
github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA=
4+
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
5+
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
6+
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
7+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
8+
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
9+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
10+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
12+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
13+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
File renamed without changes.

misc/bin/mount.tmsu

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ export PATH
44

55
# to allow other users access to the TMSU mount, enable the 'user_allow_other' option
66
# in /etc/fuse.conf and then pass the 'allow_other' option below.
7-
#tmsu mount options=allow_other $1 $2
7+
#tmsu mount --options=allow_other $1 $2
88

9-
tmsu mount $1 $2
9+
# Mount passes the options given after -o in the 4th argument
10+
if [[ $4 = *"allow_other"* ]]; then
11+
MOUNT_OPTIONS='allow_other'
12+
fi
13+
14+
if [[ $MOUNT_OPTIONS ]]; then
15+
tmsu mount --verbose --database="$1" "--options=${MOUNT_OPTIONS}" "$2"
16+
else
17+
tmsu mount --verbose --database="$1" "$2"
18+
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/github.com/oniony/TMSU/storage/database/file.go storage/database/file.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ FROM file
100100
WHERE directory = ? OR directory LIKE ?`
101101

102102
if pathContainsRoot {
103-
sql += `OR directory = '.' OR directory LIKE './%`
103+
sql += `OR directory = '.' OR directory LIKE './%'`
104104
}
105105

106106
sql += `
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/values/list_values

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
# setup
44

55
touch /tmp/tmsu/file1
6-
tmsu tag /tmp/tmsu/file1 year=2015 year=2016 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
6+
tmsu tag /tmp/tmsu/file1 year=2015 year=2016 'tag=MMXXII\=2022' >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
77

88
# test
99

10-
tmsu values >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
10+
tmsu values >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
1111

1212
# verify
1313

1414
diff /tmp/tmsu/stderr - <<EOF
1515
tmsu: new tag 'year'
1616
tmsu: new value '2015'
1717
tmsu: new value '2016'
18+
tmsu: new tag 'tag'
19+
tmsu: new value 'MMXXII=2022'
1820
EOF
1921
if [[ $? -ne 0 ]]; then
2022
exit 1
@@ -23,6 +25,7 @@ fi
2325
diff /tmp/tmsu/stdout - <<EOF
2426
2015
2527
2016
28+
MMXXII=2022
2629
EOF
2730
if [[ $? -ne 0 ]]; then
2831
exit 1

tests/values/list_values_for_tag

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# setup
44

55
touch /tmp/tmsu/file1
6-
tmsu tag /tmp/tmsu/file1 vegetable=brocolli year=2015 year=2016 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
6+
tmsu tag /tmp/tmsu/file1 vegetable=brocolli year=2015 year=2016 'year=MMXXII\=2022' >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
77

88
# test
99

10-
tmsu values year >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
10+
tmsu values year >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
1111

1212
# verify
1313

@@ -17,6 +17,7 @@ tmsu: new value 'brocolli'
1717
tmsu: new tag 'year'
1818
tmsu: new value '2015'
1919
tmsu: new value '2016'
20+
tmsu: new value 'MMXXII=2022'
2021
EOF
2122
if [[ $? -ne 0 ]]; then
2223
exit 1
@@ -25,6 +26,7 @@ fi
2526
diff /tmp/tmsu/stdout - <<EOF
2627
2015
2728
2016
29+
MMXXII=2022
2830
EOF
2931
if [[ $? -ne 0 ]]; then
3032
exit 1
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)