diff options
Diffstat (limited to 'git-pull-request.sh')
-rwxr-xr-x | git-pull-request.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/git-pull-request.sh b/git-pull-request.sh index ca16004..065e264 100755 --- a/git-pull-request.sh +++ b/git-pull-request.sh @@ -17,6 +17,7 @@ reject Reject a pull request archive Archive a pull request attach Attach a file to a pull request +ls List files attached to a pull request -- General Options @@ -482,6 +483,33 @@ EOF rgit update-ref -m "Attached '${FILE}' as '${AS}' to '${PR}'" \ "${BRANCH}" "${CSHA}" "${METADATA[META_SHA]}" say "'${FILE}' attached as '${AS}'" + rm -f "${PR_EDIT_MSG}" + rm -f "${PR_INDEX_FILE}" +} + +cmd_ls () { + local PR + PR="$1" + if test "x$PR" = "x"; then + echo >&2 "Please specify a pull-request name to list attachments of." + exit 1 + fi + local COMMIT BRANCH + while read _COMMIT _BRANCH; do + COMMIT="${_COMMIT}" + BRANCH="${_BRANCH}" + done <<<$(rgit show-ref "$PR"__meta) + if test "x$COMMIT" = "x"; then + echo >&2 "Pull request '${PR}' not found." + exit 1 + fi + + load_meta_from "${COMMIT}" + load_index_from "${COMMIT}" + + GIT_INDEX_FILE="${PR_INDEX_FILE}" rgit ls-files attached | \ + sed -e's@^attached/@@' + rm -f "${PR_INDEX_FILE}" } ############################################################################# |