Skip to content

Commit

Permalink
Generate handin tarballs via git.
Browse files Browse the repository at this point in the history
Previously, the tarball rule sucked in everything in sight.  This
allows students to better control what gets handed in and code
reviewed.  The rule checks several sanity conditions before creating
the archive.
  • Loading branch information
Austin Clements committed Nov 3, 2011
1 parent 5c6d2e7 commit e7799a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/wget.log
/slirp.cap
/qemu.out
/qemu.log
/lab?-handin.tar.gz
/lab?/
/sol?/
Expand Down
20 changes: 18 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,24 @@ handin: tarball
@echo Please visit http://pdos.csail.mit.edu/6.828/submit/
@echo and upload lab$(LAB)-handin.tar.gz. Thanks!

tarball: realclean
tar cf - `find . -type f | grep -v '^\.*$$' | grep -v '/CVS/' | grep -v '/\.svn/' | grep -v '/\.git/' | grep -v 'lab[0-9].*\.tar\.gz'` | gzip > lab$(LAB)-handin.tar.gz
tarball:
@if test "$$(git symbolic-ref HEAD)" != refs/heads/lab$(LAB); then \
git branch; \
read -p "You are not on the lab$(LAB) branch. Handin the current branch? [y/N] " r; \
test "$$r" = y; \
fi
@if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD; then \
git status; \
echo; \
echo "You have uncomitted changes. Please commit or stash them."; \
false; \
fi
@if test -n "`git ls-files -o --exclude-standard`"; then \
git status; \
read -p "Untracked files will not be handed in. Continue? [y/N] " r; \
test "$$r" = y; \
fi
git archive --format=tar HEAD | gzip > lab$(LAB)-handin.tar.gz

# For test runs
prep-%:
Expand Down
2 changes: 1 addition & 1 deletion conf/lab.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LAB=4
PACKAGEDATE=Tue Nov 1 19:35:08 EDT 2011
PACKAGEDATE=Wed Nov 2 21:31:50 EDT 2011

0 comments on commit e7799a7

Please sign in to comment.