Commit 8c3713c
stash: eliminate crude option parsing
Eliminate crude option parsing and rely on real parsing instead, because
1) Crude parsing is crude, for example it's not capable of
handling things like `git stash -m Message`
2) Adding options in two places is inconvenient and prone to bugs
As a side result, the case of `git stash -m Message` gets fixed.
Also give a good error message instead of just throwing usage at user.
----
Some review of what's been happening to this code:
Before [1], `git-stash.sh` only verified that all args begin with `-` :
# The default command is "push" if nothing but options are given
seen_non_option=
for opt
do
case "$opt" in
--) break ;;
-*) ;;
*) seen_non_option=t; break ;;
esac
done
Later, [1] introduced the duplicate code I'm now removing, also making
the previous test more strict by white-listing options.
----
[1] Commit 40af146 ("stash: convert `stash--helper.c` into `stash.c`" 2019-02-26)
Signed-off-by: Alexandr Miloslavskiy <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 3f3d806 commit 8c3713c
2 files changed
+26
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1448 | 1448 | | |
1449 | 1449 | | |
1450 | 1450 | | |
1451 | | - | |
| 1451 | + | |
| 1452 | + | |
1452 | 1453 | | |
| 1454 | + | |
1453 | 1455 | | |
1454 | 1456 | | |
1455 | 1457 | | |
| |||
1471 | 1473 | | |
1472 | 1474 | | |
1473 | 1475 | | |
1474 | | - | |
| 1476 | + | |
| 1477 | + | |
1475 | 1478 | | |
1476 | 1479 | | |
1477 | | - | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1478 | 1492 | | |
1479 | 1493 | | |
1480 | 1494 | | |
| |||
1547 | 1561 | | |
1548 | 1562 | | |
1549 | 1563 | | |
1550 | | - | |
1551 | 1564 | | |
1552 | 1565 | | |
1553 | 1566 | | |
| |||
1580 | 1593 | | |
1581 | 1594 | | |
1582 | 1595 | | |
1583 | | - | |
| 1596 | + | |
1584 | 1597 | | |
1585 | 1598 | | |
1586 | 1599 | | |
| |||
1600 | 1613 | | |
1601 | 1614 | | |
1602 | 1615 | | |
1603 | | - | |
| 1616 | + | |
1604 | 1617 | | |
1605 | 1618 | | |
1606 | 1619 | | |
1607 | 1620 | | |
1608 | 1621 | | |
1609 | 1622 | | |
1610 | | - | |
1611 | | - | |
1612 | | - | |
1613 | | - | |
1614 | | - | |
1615 | | - | |
1616 | | - | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
1628 | | - | |
1629 | | - | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
1634 | | - | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
| 1623 | + | |
1641 | 1624 | | |
1642 | 1625 | | |
1643 | | - | |
| 1626 | + | |
1644 | 1627 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
288 | 293 | | |
289 | 294 | | |
290 | 295 | | |
| |||
0 commit comments