-
Notifications
You must be signed in to change notification settings - Fork 46
/
GitFileEmptyTree.kt
76 lines (69 loc) · 2.38 KB
/
GitFileEmptyTree.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* This file is part of git-as-svn. It is subject to the license terms
* in the LICENSE file found in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/gpl-2.0.html. No part of git-as-svn,
* including this file, may be copied, modified, propagated, or distributed
* except according to the terms contained in the LICENSE file.
*/
package svnserver.repository.git
import org.eclipse.jgit.lib.FileMode
import org.eclipse.jgit.lib.ObjectId
import svnserver.repository.VcsCopyFrom
import svnserver.repository.git.filter.GitFilter
import svnserver.repository.git.prop.GitProperty
import java.io.InputStream
/**
* Git file.
*
* @author Artem V. Navrotskiy <bozaro@users.noreply.github.com>
*/
internal class GitFileEmptyTree(override val branch: GitBranch, parentPath: String, override val revision: Int) : GitEntryImpl(GitProperty.emptyArray, parentPath, GitProperty.emptyArray, "", FileMode.TREE, branch.repository.context.shared.stringInterner), GitFile {
override fun createChild(name: String, isDir: Boolean, stringInterner: (String) -> String): GitEntry {
return super<GitEntryImpl>.createChild(name, isDir, stringInterner)
}
override fun getEntry(name: String): GitFile? {
return null
}
override val contentHash: String
get() {
throw IllegalStateException("Can't get content hash without object.")
}
override val md5: String
get() {
throw IllegalStateException("Can't get md5 without object.")
}
override val size: Long
get() {
return 0L
}
override fun openStream(): InputStream {
throw IllegalStateException("Can't get open stream without object.")
}
override val copyFrom: VcsCopyFrom?
get() {
return lastChange.getCopyFrom(fullPath)
}
override val filter: GitFilter?
get() {
return null
}
override val treeEntry: GitTreeEntry?
get() {
return null
}
override val objectId: GitObject<ObjectId>?
get() {
return null
}
override val fileMode: FileMode
get() {
return FileMode.TREE
}
override val entries: Map<String, GitFile>
get() {
return emptyMap()
}
override fun toString(): String {
return "GitFileEmptyTree{fullPath='$fullPath'}"
}
}