This imitates the behaviour of git-commit.
Noticed by Han-Wen Nienhuys.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This updates the use of git-update-ref in git-branch, git-tag
and git-commit to make them safer in a few corner cases as
demonstration.
- git-tag makes sure that the named tag does not exist, allows
you to edit tag message and then creates the tag. If a tag
with the same name was created by somebody else in the
meantime, it used to happily overwrote it. Now it notices
the situation.
- git-branch -d and git-commit (for the initial commit) had the
same issue but with smaller race window, which is plugged
with this.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Some words, e.g., `match', are special to expr(1), and cause strange
parsing effects. Track down all uses of expr and mangle the arguments
so that this isn't a problem.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
FreeBSD 4.11 being one example: the built-in echo doesn't have -e,
and the installed /bin/echo does not do "-e" as well.
"printf" works, laking just "\e" and "\xAB'.
Signed-off-by: Junio C Hamano <junkio@cox.net>
As a fallout from not using git-sh-setup in scripts that can
operate from a subdirectory, we lost definition of die() from
them. It might make sense to do some cleanup to consolidate
them back again, but this should suffice for now.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository. So move the code
that dies from all callers to git-sh-setup script.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This adds option '-d' to git-tag.sh and documents it.
Signed-off-by: Kai Ruemmler <kai.ruemmler@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is a companion patch to 13d1cc3604
commit, which made hierarchical branch name possible. "git tag
v0.99.9/a" would fail otherwise.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is a long overdue companion commit that fixed git-commit
(Santi's f8e2c54c9a).
Having the temporary files in the working tree root when making
tags is not as bad because it does not involve 'git status' as
the git-commit case, but this makes things more consistent.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Update check_ref_format() function to reject ref names that:
* has a path component that begins with a ".", or
* has a double dots "..", or
* has ASCII control character, "~", "^", ":" or SP, anywhere, or
* ends with a "/".
Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure
that newly created refs are well-formed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Update check_ref_format() function to reject ref names that:
* has a path component that begins with a ".", or
* has a double dots "..", or
* has ASCII control character, "~", "^", ":" or SP, anywhere, or
* ends with a "/".
Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure
that newly created refs are well-formed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The current "git tag -s" thing always uses the tagger name as the signing
user key, which is very irritating, since my key is under my email
address, but the tagger key obviously contains the actual machine name
too.
Now, I could just use "GIT_COMMITTER_EMAIL" and force it to be my real
email, but I actually think that it's nice to see which machine I use for
my work.
So rather than force my tagger ID to have to match the gpg key name, just
support the "-u" flag to "git tag" instead. It implicitly enables signing,
since it doesn't make any sense without it. Thus:
git tag -u <gpg-key-name> <tag-name> [<tagged-object>]
will use the named gpg key for signing.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
As promised, this is the "big tool rename" patch. The primary differences
since 0.99.6 are:
(1) git-*-script are no more. The commands installed do not
have any such suffix so users do not have to remember if
something is implemented as a shell script or not.
(2) Many command names with 'cache' in them are renamed with
'index' if that is what they mean.
There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support is expected to be removed in the near
future.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Make sure that we say --verify when we want to get a single SHA1
name. Also when we say --verify, --revs-only is redundant.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Allow users to create a tag message by passing message on command line
instead of requiring an $EDITOR session.
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This adds -a (annotate only but not sign) option "A Large Angry
SCM" <gitzilla@gmail.com> sent to the list, after fixing up the
whitespace corruption in the patch, with some of my own fixes.
Namely:
* A new flag '-a' can be used to create an unsigned tag
object;
* The '-f' flag logic did not do the right thing;
* When creating a signed tag, we did not check for GPG failure
as we should;
* Try to use the key for the tagger identity when signing the
tag.
Signed-off-by: Junio C Hamano <junkio@cox.net>
A simple tag is just a direct pointer to the object, while a signed tag
is a pointer to a "tag object" that has a pgp signature and points to
the object we tagged.
Use "git tag -s tagname" to create a signed tag.
The "-f" flag overwrites any previous tag of that name (useful if you
update a tag to point to a newer version for things like "latest" etc
tags that aren't necessarily static versions).
And finally what all of this has been leading up to.
The 2 line code change to record who made a tag,
and the 8 line code change to check that we recorded
the tag.
Gosh the error checking is always so much bigger than the code :)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
When testing tags I ran into an interesting problem.
git-tag-script dies if .git/refs/tags/ does not exist.
And that directory didn't get created when I build my repository,
so we need to create it if it doesn't exist.
Signed-of-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Instead of having to cut-and-paste the result, write it to the tag
directory directly. Also, start an editor for the tag message, rather
than just reading it from stdin.
During the mailing list discussion on renaming GIT_ environment
variables, people felt that having one environment that lets the
user (or Porcelain) specify both SHA1_FILE_DIRECTORY (now
GIT_OBJECT_DIRECTORY) and GIT_INDEX_FILE for the default layout
would be handy. This change introduces GIT_DIR environment
variable, from which the defaults for GIT_INDEX_FILE and
GIT_OBJECT_DIRECTORY are derived. When GIT_DIR is not defined,
it defaults to ".git". GIT_INDEX_FILE defaults to
"$GIT_DIR/index" and GIT_OBJECT_DIRECTORY defaults to
"$GIT_DIR/objects".
Special thanks for ideas and discussions go to Petr Baudis and
Daniel Barkalow. Bugs are mine ;-)
Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus said:
"Let's see what else I forgot.."
Not that many, but here they are.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>