diff --git a/CLAUDE.md b/CLAUDE.md index 6fd227c..8c76a6b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ Platform bridges: `gh` (GitHub), `glab` (GitLab), REST API (Gitea/Forgejo). ## Key Commands ```bash -make test # Run all 282 tests +make test # Run all 284 tests make install # Install system-wide (/usr/local) git issue create "title" -l bug # Create issue with label git issue ls --format full # List issues with metadata diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5314fa9..a635dfa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Thanks for your interest in contributing! This project welcomes contributions fr ```bash git clone https://github.com/remenoscodes/git-native-issue.git cd git-native-issue -make test # Run all 282 tests +make test # Run all 284 tests ``` ## Development Setup diff --git a/README.md b/README.md index 1ff9409..928041e 100644 --- a/README.md +++ b/README.md @@ -652,7 +652,7 @@ the deliverable that makes ecosystem adoption possible. make test ``` -282 tests: core (77), bridge (37), merge/fsck (21), QoL (22), validation (36), quality (59), edge cases (13), comment sync (8), concurrency (9). +284 tests: core (79), bridge (37), merge/fsck (21), QoL (22), validation (36), quality (59), edge cases (13), comment sync (8), concurrency (9). ## Performance Notes diff --git a/bin/git-issue-comment b/bin/git-issue-comment index bf821d1..5bd97d2 100755 --- a/bin/git-issue-comment +++ b/bin/git-issue-comment @@ -12,7 +12,7 @@ usage() { usage: git issue comment -m Options: - -m, --message Comment text (required) + -m, --message Comment text; use multiple times for paragraphs -h, --help Show this help EOF exit 1 @@ -42,7 +42,12 @@ do case "$1" in -m|--message) test $# -ge 2 || { echo "error: -m requires a value" >&2; exit 1; } - message="$2" + if test -n "$message" + then + message="$(printf '%s\n\n%s' "$message" "$2")" + else + message="$2" + fi shift 2 ;; -h|--help) diff --git a/bin/git-issue-create b/bin/git-issue-create index fe90f5a..7556a07 100755 --- a/bin/git-issue-create +++ b/bin/git-issue-create @@ -12,7 +12,7 @@ usage() { usage: git issue create [options] Options: - -m, --message <text> Issue description (body) + -m, --message <text> Issue description (body); use multiple times for paragraphs -l, --label <label> Add a label (can be repeated) -a, --assignee <email> Assign to someone -p, --priority <level> Set priority (low, medium, high, critical) @@ -34,7 +34,12 @@ do case "$1" in -m|--message) test $# -ge 2 || { echo "error: -m requires a value" >&2; exit 1; } - body="$2" + if test -n "$body" + then + body="$(printf '%s\n\n%s' "$body" "$2")" + else + body="$2" + fi shift 2 ;; -l|--label) diff --git a/t/test-issue.sh b/t/test-issue.sh index 64c8560..f08e95f 100755 --- a/t/test-issue.sh +++ b/t/test-issue.sh @@ -204,6 +204,24 @@ case "$body" in ;; esac +# ============================================================ +# TEST: create with multiple -m flags builds multi-paragraph body +# ============================================================ +run_test +setup_repo +git issue create "Multi-paragraph issue" -m "First paragraph" -m "Second paragraph" >/dev/null +ref="$(git for-each-ref --format='%(refname)' refs/issues/ | head -1)" +root="$(git rev-list --max-parents=0 "$ref")" +body="$(git log -1 --format='%b' "$root" | sed '/^[A-Z][A-Za-z-]*: /d')" +case "$body" in + *"First paragraph"*"Second paragraph"*) + pass "create with multiple -m flags builds multi-paragraph body" + ;; + *) + fail "create with multiple -m flags builds multi-paragraph body" "got: '$body'" + ;; +esac + # ============================================================ # TEST: create with priority # ============================================================ @@ -766,6 +784,25 @@ else fail "three comments create correct 4-commit chain" "got $total commits" fi +# ============================================================ +# TEST: comment with multiple -m flags builds multi-paragraph body +# ============================================================ +run_test +setup_repo +out="$(git issue create "Comment paragraph test" 2>&1)" +id="$(printf '%s' "$out" | sed 's/Created issue //')" +git issue comment "$id" -m "First paragraph" -m "Second paragraph" >/dev/null +ref="$(git for-each-ref --format='%(refname)' refs/issues/ | head -1)" +full="$(git log -1 --format='%B' "$ref")" +case "$full" in + *"First paragraph"*"Second paragraph"*) + pass "comment with multiple -m flags builds multi-paragraph body" + ;; + *) + fail "comment with multiple -m flags builds multi-paragraph body" "got: '$full'" + ;; +esac + # ============================================================ # TEST: state --state custom value # ============================================================