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...@@ -123,7 +123,7 @@ pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !strin
123 },123 },
124 .git => {124 .git => {
125 if (d.version.len > 0) {125 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) {
127 error.IterEmpty => unreachable,127 error.IterEmpty => unreachable,
128 error.NoMemberFound => {128 error.NoMemberFound => {
129 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];129 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 {...@@ -65,7 +65,7 @@ pub const Dep = struct {
65 }65 }
66 return switch (self.type) {66 return switch (self.type) {
67 .git => blk: {67 .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);
69 if (vers.id.frozen()) break :blk self.version;69 if (vers.id.frozen()) break :blk self.version;
70 break :blk try self.type.exact_version(dpath);70 break :blk try self.type.exact_version(dpath);
71 },71 },
src/util/dep_type.zig+12-12
...@@ -89,18 +89,18 @@ pub const DepType = enum {...@@ -89,18 +89,18 @@ pub const DepType = enum {
89 .http => "",89 .http => "",
90 };90 };
91 }91 }
92};
9392
94pub const GitVersionType = enum {93 pub const GitVersion = enum {
95 branch,94 branch,
96 tag,95 tag,
97 commit,96 commit,
9897
99 pub fn frozen(self: GitVersionType) bool {98 pub fn frozen(self: GitVersion) bool {
100 return switch (self) {99 return switch (self) {
101 .branch => false,100 .branch => false,
102 .tag => true,101 .tag => true,
103 .commit => true,102 .commit => true,
104 };103 };
105 }104 }
105 };
106};106};