authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 02:34:43 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 02:34:43 -07:00
loge16a1f6d945521ff0cd81d6486dbbe86ae7c038f
tree9502ad89e6f651915cfcb8abad4b40a93170d9d9
parentcffd3642f4f37d3a10db16a076145dc95141a10e

move GitVersion inside of DepType


3 files changed, 14 insertions(+), 14 deletions(-)

src/common.zig+1-1
......@@ -123,7 +123,7 @@ pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !strin
123123 },
124124 .git => {
125125 if (d.version.len > 0) {
126 const vers = u.parse_split(u.GitVersionType, "-").do(d.version) catch |e| switch (e) {
126 const vers = u.parse_split(u.DepType.GitVersion, "-").do(d.version) catch |e| switch (e) {
127127 error.IterEmpty => unreachable,
128128 error.NoMemberFound => {
129129 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];
src/util/dep.zig+1-1
......@@ -65,7 +65,7 @@ pub const Dep = struct {
6565 }
6666 return switch (self.type) {
6767 .git => blk: {
68 const vers = try u.parse_split(u.GitVersionType, "-").do(self.version);
68 const vers = try u.parse_split(u.DepType.GitVersion, "-").do(self.version);
6969 if (vers.id.frozen()) break :blk self.version;
7070 break :blk try self.type.exact_version(dpath);
7171 },
src/util/dep_type.zig+12-12
......@@ -89,18 +89,18 @@ pub const DepType = enum {
8989 .http => "",
9090 };
9191 }
92};
9392
94pub const GitVersionType = enum {
95 branch,
96 tag,
97 commit,
93 pub const GitVersion = enum {
94 branch,
95 tag,
96 commit,
9897
99 pub fn frozen(self: GitVersionType) bool {
100 return switch (self) {
101 .branch => false,
102 .tag => true,
103 .commit => true,
104 };
105 }
98 pub fn frozen(self: GitVersion) bool {
99 return switch (self) {
100 .branch => false,
101 .tag => true,
102 .commit => true,
103 };
104 }
105 };
106106};