From afefba74886f27d3767d48e0be86d97dbeaceb07 Mon Sep 17 00:00:00 2001 From: Philipp Klose Date: Fri, 15 Feb 2013 05:35:06 +0100 Subject: [PATCH 1/3] import from https://github.com/TheHippo/git-archive-file --- bin/git-archive-file | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bin/git-archive-file diff --git a/bin/git-archive-file b/bin/git-archive-file new file mode 100755 index 0000000..e9dca7d --- /dev/null +++ b/bin/git-archive-file @@ -0,0 +1,34 @@ +#!/bin/bash + +# extract current branch name +BRANCH=$(git name-rev HEAD 2> /dev/null | awk "{ print \$2 }") + +# get name of the most top folder of current directory, used for the +# output filename +ARCHIVE_NAME=$(basename $(pwd)) + +if [[ $BRANCH = tags* ]]; then + BRANCH=$(git describe) + echo Building for tag \"$BRANCH\" + FILENAME=$ARCHIVE_NAME.$BRANCH.zip +else + echo Building archive on branch \"$BRANCH\" + # get a version string, so archives will not be overwritten when creating + # many of them + VERSION=$(git describe --always --long) + # if not on master append branch name into the filename + if [ "$BRANCH" = "master" ]; then + FILENAME=$ARCHIVE_NAME.$VERSION.zip + else + FILENAME=$ARCHIVE_NAME.$VERSION.$BRANCH.zip + fi +fi + +# combine path and filename +OUTPUT=$(pwd)/$FILENAME + +# building archive +git archive --format zip --output $OUTPUT $BRANCH + +# also display size of the resulting file +echo Saved to \"$FILENAME\" \(`du -h $OUTPUT | cut -f1`\) \ No newline at end of file From cbee46ceea9adc180a719fda0d2eceba50de807c Mon Sep 17 00:00:00 2001 From: Philipp Klose Date: Fri, 15 Feb 2013 05:46:21 +0100 Subject: [PATCH 2/3] added man pages for git-archive-file --- man/git-archive-file.1 | 37 ++++++++++++ man/git-archive-file.html | 120 ++++++++++++++++++++++++++++++++++++++ man/git-archive-file.md | 37 ++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 man/git-archive-file.1 create mode 100644 man/git-archive-file.html create mode 100644 man/git-archive-file.md diff --git a/man/git-archive-file.1 b/man/git-archive-file.1 new file mode 100644 index 0000000..62de801 --- /dev/null +++ b/man/git-archive-file.1 @@ -0,0 +1,37 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-ARCHIVE\-FILE" "1" "February 2013" "" "Git Extras" +. +.SH "NAME" +\fBgit\-archive\-file\fR \- Export the current HEAD of the git repository to a archive +. +.SH "SYNOPSIS" +\fBgit\-archive\-file\fR +. +.SH "DESCRIPTION" +Export the current HEAD of the repository into a archive with a identifiable and unique name\. +. +.SH "OPTIONS" +This command does not take any options\. +. +.SH "EXAMPLES" +Archive naming conventions: +. +.P +On any branch: \fBgit\-extras\.1\.7\.0\-110\-gafefba7\.branch\-name\.zip\fR +. +.P +On master branch: \fBgit\-extras\.1\.7\.0\-110\-gafefba7\.zip\fR +. +.P +On a detached HEAD (e\.g\. a tag): \fBgit\-extras\.1\.7\.0\.zip\fR +. +.SH "AUTHOR" +Written by Philipp Klose <\fIme@thehippo\.de\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/visionmedia/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/visionmedia/git\-extras\fR> diff --git a/man/git-archive-file.html b/man/git-archive-file.html new file mode 100644 index 0000000..e7f2cf7 --- /dev/null +++ b/man/git-archive-file.html @@ -0,0 +1,120 @@ + + + + + + git-archive-file(1) - Export the current HEAD of the git repository to a archive + + + + +
+ + + +
    +
  1. git-archive-file(1)
  2. +
  3. Git Extras
  4. +
  5. git-archive-file(1)
  6. +
+ +

NAME

+

+ git-archive-file - Export the current HEAD of the git repository to a archive +

+ +

SYNOPSIS

+ +

git-archive-file

+ +

DESCRIPTION

+ +

Export the current HEAD of the repository into a archive with a identifiable and unique name.

+ +

OPTIONS

+ +

This command does not take any options.

+ +

EXAMPLES

+ +

Archive naming conventions:

+ +

On any branch: git-extras.1.7.0-110-gafefba7.branch-name.zip

+ +

On master branch: git-extras.1.7.0-110-gafefba7.zip

+ +

On a detached HEAD (e.g. a tag): git-extras.1.7.0.zip

+ +

AUTHOR

+ +

Written by Philipp Klose <me@thehippo.de>

+ +

REPORTING BUGS

+ +

<https://github.com/visionmedia/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/visionmedia/git-extras>

+ + +
    +
  1. +
  2. February 2013
  3. +
  4. git-archive-file(1)
  5. +
+ +
+ + diff --git a/man/git-archive-file.md b/man/git-archive-file.md new file mode 100644 index 0000000..df12b40 --- /dev/null +++ b/man/git-archive-file.md @@ -0,0 +1,37 @@ +git-archive-file(1) -- Export the current HEAD of the git repository to a archive +=============================================== + +## SYNOPSIS + +`git-archive-file` + +## DESCRIPTION + +Export the current HEAD of the repository into a archive with a identifiable and unique name. + +## OPTIONS + +This command does not take any options. + + +## EXAMPLES + +Archive naming conventions: + +On any branch: `git-extras.1.7.0-110-gafefba7.branch-name.zip` + +On master branch: `git-extras.1.7.0-110-gafefba7.zip` + +On a detached HEAD (e.g. a tag): `git-extras.1.7.0.zip` + +## AUTHOR + +Written by Philipp Klose <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From 89440e019bbc9f3fdd1ccb225e4f250f6991155d Mon Sep 17 00:00:00 2001 From: Philipp Klose Date: Sun, 17 Feb 2013 19:48:54 +0100 Subject: [PATCH 3/3] added git-archive-file to Readme.md --- Readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Readme.md b/Readme.md index 7675e0f..4fce5c2 100644 --- a/Readme.md +++ b/Readme.md @@ -65,6 +65,7 @@ $ brew install git-extras - `git bug` - `git promote` - `git local-commits` + - `git archive-file` ## git-extras @@ -518,3 +519,7 @@ git obliterate secrets.json ## git-local-commits List all commits on the local branch that have not yet been sent to origin. Any additional arguments will be passed directly to git log. + +## git-archive-file + +Creates an zip archive of the current git repository. The name of the archive will depend on the current HEAD of your git respository.