If we decide to use refs/remotes/, having a convenient way to
list them would be nice.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
There were some problems with the usage message clean-up patch
series. I hadn't realised that subdirectory aware scripts can't source
git-sh-setup. I propose that we change this and let the scripts which
are subdirectory aware set a variable, SUBDIRECTORY_OK, before they
source git-sh-setup.
The scripts will also set USAGE and possibly LONG_USAGE before they
source git-sh-setup. If LONG_USAGE isn't set it defaults to USAGE.
If we go this way it's easy to catch --help in git-sh-setup, print the
(long) usage message to stdout and exit cleanly. git-sh-setup can
define a 'usage' shell function which can be called by the scripts to
print the short usage string to stderr and exit non-cleanly. It will
also be easy to change $0 to basename $0 or something else, if would
like to do that sometime in the future.
What follows is a patch to convert a couple of the commands to this
style. If it's ok with everyone to do it this way I will convert the
rest of the scripts too.
[jc: thrown in to proposed updates queue for comments.]
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>
A new usage, 'git-branch -f branch [start]', resets the branch head at
start (or current head). Should be considered a dangerous operation,
but if you are like me to keep rewinding branches it is handy.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Make git-update-ref create references with slashes in them. git-branch
and git-checkout already support such reference names.
git-branch can use git-update-ref to create the references in a more
formal manner now.
Signed-off-by: Junio C Hamano <junkio@cox.net>
"git-checkout -b frotz/nitfol master" failed to create
$GIT_DIR/refs/heads/frotz/nitfol but went ahead and updated
$GIT_DIR/HEAD to point at it, resulting in a corrupt repository.
Exit when we cannot create the new branch with an error status.
While we are at it, there is no reason to forbid subdirectories
in refs/heads, so make sure we handle that correctly.
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>
This adds the counterpart of git-update-ref that lets you read
and create "symbolic refs". By default it uses a symbolic link
to represent ".git/HEAD -> refs/heads/master", but it can be compiled
to use the textfile symbolic ref.
The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah
.git/HEAD' have been converted to use new git-symbolic-ref command, so
that they can deal with either implementation.
Signed-off-by: Junio C Hamano <junio@twinsun.com>
The new flag '-d' lets you delete a branch. For safety, it does not
lets you delete the branch you are currently on, nor a branch that
has been fully merged into your current branch.
The credit for the safety check idea goes to Daniel Barkalow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
If you run `git branch --help', you will unexpectedly have created a new
branch named "--help". This simple patch adds logic and a usage
statement to catch this and similar problems, and adds a testcase for it.
Signed-off-by: Amos Waterland <apw@rossby.metr.ou.edu>
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>