diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-05-25 13:28:54 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-05-25 13:28:54 +0100 |
commit | 31d3cb8588445513bb8f41d64e7122507c51d54e (patch) | |
tree | 15320d99f64e5e231e5fb1e71fdd15239fc32cc7 | |
parent | 8414a7f8d0a68a0200e45aa6c4415cf594808c30 (diff) | |
download | git-pull-request-31d3cb8588445513bb8f41d64e7122507c51d54e.tar.bz2 |
ls
-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}" } ############################################################################# |