Docker drops comment lines before it joins continued lines; the grammar * ends an instruction at one (kubermatic: `ENV A=1 \` / `# url` / `B=2`). * A comment line inside a continuation becomes a bare continuation (`#` -> * `\`, the rest blank) -- rows and offsets stay. A file with an escape * directive is left as it is. */
| 1485 | * `\`, the rest blank) -- rows and offsets stay. A file with an escape |
| 1486 | * directive is left as it is. */ |
| 1487 | static void dk_uncomment(char *s, size_t len) { |
| 1488 | bool cont = false; |
| 1489 | bool top = true; /* still in the leading directives */ |
| 1490 | for (size_t i = 0; i < len;) { |
| 1491 | size_t e = i; |
| 1492 | while (e < len && s[e] != '\n') { |
| 1493 | e++; |
| 1494 | } |
| 1495 | size_t b = i; |
| 1496 | while (b < e && (s[b] == ' ' || s[b] == '\t')) { |
| 1497 | b++; |
| 1498 | } |
| 1499 | if (b < e && s[b] == '#') { |
| 1500 | if (top && dk_escape_directive(s, b, e)) { |
| 1501 | return; |
| 1502 | } |
| 1503 | if (cont) { |
| 1504 | s[b] = '\\'; |
| 1505 | for (size_t k = b + SKIP_ONE; k < e && s[k] != '\r'; k++) { |
| 1506 | s[k] = ' '; |
| 1507 | } |
| 1508 | } |
| 1509 | } else if (b < e && s[b] != '\r') { |
| 1510 | size_t t = e; |
| 1511 | while (t > b && |
| 1512 | (s[t - SKIP_ONE] == ' ' || s[t - SKIP_ONE] == '\t' || s[t - SKIP_ONE] == '\r')) { |
| 1513 | t--; |
| 1514 | } |
| 1515 | cont = s[t - SKIP_ONE] == '\\'; |
| 1516 | top = false; |
| 1517 | } else { |
| 1518 | top = false; |
| 1519 | } |
| 1520 | i = e + SKIP_ONE; |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | typedef struct { |
| 1525 | cbm_pipeline_ctx_t *ctx; |
no test coverage detected