From 31d3cb8588445513bb8f41d64e7122507c51d54e Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 25 May 2012 13:28:54 +0100 Subject: ls --- git-pull-request.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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}" } ############################################################################# -- cgit v1.2.1