navid/veins / commit

7780ca2f96cf

Navid M <navidmomtahen@gmail.com> · 2026-11-26

parents: 3a4dc29740f3

Browse files at this commit · Download source

cli: require non-empty commit message
--- a/veins/src/cli/help_cmd.sx+++ b/veins/src/cli/help_cmd.sx@@ -229,6 +229,8 @@     stdio.puts("usage: vn go -message <message>")     stdio.puts("")     stdio.puts("set the message and start a new change")+    stdio.puts("")+    stdio.puts("a non-empty commit message is required")     stdio.puts("")     stdio.puts("aliases: commit") }--- a/veins/src/main.sx+++ b/veins/src/main.sx@@ -378,8 +378,22 @@         none => {             @listfree(parts)             return 1+        }+    }+}++fn message_is_blank(parts: list[bytes.Bytes]) bool = trust {+    for p in parts {+        val i: mut usize = 0+        for i < p.len {+            val c: u8 = bytes.Bytes.at(p, i)+            if c != 32 && c != 9 && c != 10 && c != 13 {+                return false+            }+            i++         }     }+    return true }  fn run_commit(args: list[ref u8], start: usize) i32 = trust {@@ -392,6 +406,12 @@         err code => {             return code         }+    }+    if message_is_blank(parts) {+        msg.error_prefix()+        stdio.eprint("commit requires a non-empty message (-message)\n", {})+        @listfree(parts)+        return 1     }     val repo_opt = open_repo_or_error(str.from_cstr(c"."))     match repo_opt {