Commit graph

585 commits

Author SHA1 Message Date
Shawn O. Pearce 88e21dc746 Teach bash about completing arguments for git-tag
Lately I have been doing a lot of calls to `git tag -d` and also to
`git tag -v`.  In both such cases being able to complete the names
of existing tags saves the fingers some typing effort.  We now look
for the -d or -v option to git-tag in the bash completion support
and offer up existing tag names as possible choices for these.

When creating a new tag we now also offer bash completion support
for the second argument to git-tag (the object to be tagged) as this
can often be a specific existing branch name and is not necessarily
the current HEAD.

If the -f option is being used to recreate an existing tag we now
also offer completion support on the existing tag names for the
first argument of git-tag, helping to the user to reselect the
prior tag name that they are trying to replace.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-31 23:47:01 -04:00
Johannes Schindelin 7d37b5bf4e completion: also complete git-log's --left-right and --cherry-pick option
Both --left-right and --cherry-pick are particularly long to type, so
help the user there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-29 13:19:41 -07:00
David Kågedal 1ff55ff27b git.el: Added colors for dark background
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-29 00:08:32 -07:00
Simon Hausmann 0058a33a8e git-p4: Fix warnings about non-existant refs/remotes/p4/HEAD ref when running git-p4 sync the first time after a git clone.
Don't create the p4/HEAD symbolic ref if p4/master doesn't exist yet.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Simon Hausmann 5ca4461728 git-p4: Make 'git-p4 branches' work after an initial clone with git clone from an origin-updated repository.
After a clone with "git clone" of a repository the p4 branches are only in remotes/origin/p4/* and not in remotes/p4/*.
Separate the code for detection and creation out of the P4Sync command class into standalone methods and use them
from the P4Branches command.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Shawn O. Pearce be86f7a0df Teach bash about git-submodule and its subcommands
The git-submodule command is new in 1.5.3 and contains a number
of useful subcommands for working on submodules.  We usually try
to offer the subcommands of a git command in the bash completion,
so here they are for git-submodule.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:50:49 -04:00
Shawn O. Pearce 217926c08c Teach bash to complete ref arguments to git-describe
I'm often finding that I need to run git-describe on very long
remote tracking branch names, to find out what tagged revision
the remote tracking branch is now at (or not at).  Typing out
the ref names is painful, so bash completion on them is a very
useful feature.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:42:11 -04:00
Shawn O. Pearce 47e98eecf3 Update bash completion with new 1.5.3 command line options
A number of commands have learned new tricks as part of git 1.5.3.
If these are long options (--foo) we tend to support them in the
bash completion, as it makes the user's task of using the option
slightly easier.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-23 01:39:22 -04:00
Alexandre Julliard ef08c14993 git.el: Avoid a lisp error when there's no current branch (detached HEAD).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:29:08 -07:00
Shawn O. Pearce 8fa0ee3b50 Suggest unsetting core.bare when using new-workdir on a bare repository
If core.bare is set to true in the config file of a repository that
the user is trying to create a working directory from we should
abort and suggest to the user that they remove the option first.

If we leave the core.bare=true setting in the config file then
working tree operations will get confused when they attempt to
execute in the new workdir, as it shares its config file with the
bare repository.  The working tree operations will assume that the
workdir is bare and abort, which is not what the user wants.

If we changed core.bare to be false then working tree operations
will function in the workdir but other operations may fail in the
bare repository, as it claims to not be bare.

If we remove core.bare from the config then Git can fallback on
the legacy guessing behavior.  This allows operations in the bare
repository to work as though it were bare, while operations in the
workdirs to act as though they are not bare.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:18:13 -07:00
Shawn O. Pearce e301bfeea1 Fix new-workdir (again) to work on bare repositories
My day-job workflow involves using multiple workdirs attached to a
bunch of bare repositories.  Such repositories are stored inside of
a directory called "foo.git", which means `git rev-parse --git-dir`
will return "." and not ".git".  Under such conditions new-workdir
was getting confused about where the Git repository it was supplied
is actually located.

If we get "." for the result of --git-dir query it means we should
use the user supplied path as-is, and not attempt to perform any
magic on it, as the path is directly to the repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-22 15:18:13 -07:00
Mark Levedahl 374a58c9fb git-completion.bash - add support for git-bundle
Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-19 03:38:33 -04:00
Reece H. Dunn 7da660f437 git-p4: Fix the sorting of changelists when cloning a Perforce repository.
When performing a git-p4 clone operation on a Perforce repository,
where the changelists change in order of magnitude (e.g. 100 to 1000),
the set of changes to import from is not sorted properly. This is
because the data in the list is strings not integers. The other place
where this is done already converts the value to an integer, so it is
not affected.

Acked-by: Simon Hausmann <simon@lst.de>
2007-08-13 15:23:14 -07:00
Alexandre Julliard 8fdc39729b git.el: Always set the current directory in the git-diff buffer.
This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Alexandre Julliard 09afcd6933 git.el: Add support for interactive diffs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13 12:58:38 -07:00
Junio C Hamano 55d1932bce Merge branch 'cr/tag'
* cr/tag:
  Teach "git stripspace" the --strip-comments option
  Make verify-tag a builtin.
  builtin-tag.c: Fix two memory leaks and minor notation changes.
  launch_editor(): Heed GIT_EDITOR and core.editor settings
  Make git tag a builtin.
2007-08-10 23:17:46 -07:00
Shawn O. Pearce cabead982b Use the empty tree for base diff in paranoid-update on new branches
We have to load a tree difference for the purpose of testing
file patterns.  But if our branch is being created and there is no
specific base to difference against in the rule our base will be
'0'x40.  This is (usually) not a valid tree-ish object in a Git
repository, so there's nothing to difference against.

Instead of creating the empty tree and running git-diff against
that we just take the output of `ls-tree -r --name-only` and mark
every returned pathname as an add.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 01:00:25 -07:00
Shawn O. Pearce d47eed3272 Teach the update-paranoid to look at file differences
In some applications of the update hook a user may be allowed to
modify a branch, but only if the file level difference is also an
allowed change.  This is the commonly requested feature of allowing
users to modify only certain files.

A new repository.*.allow syntax permits granting the three basic
file level operations:

  A: file is added relative to the other tree
  M: file exists in both trees, but its SHA-1 or mode differs
  D: file is removed relative to the other tree

on a per-branch and path-name basis.  The user must also have a
branch level allow line already granting them access to create,
rewind or update (CRU) that branch before the hook will consult
any file level rules.

In order for a branch change to succeed _all_ files that differ
relative to some base (by default the old value of this branch,
but it can also be any valid tree-ish) must be allowed by file
level allow rules.  A push is rejected if any diff exists that
is not covered by at least one allow rule.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 01:00:16 -07:00
Shawn O. Pearce b767c792fa Teach update-paranoid how to store ACLs organized by groups
In some applications of this paranoid update hook the set of ACL
rules that need to be applied to a user can be large, and the
number of users that those rules must also be applied to can be
more than a handful of individuals.  Rather than repeating the same
rules multiple times (once for each user) we now allow users to be
members of groups, where the group supplies the list of ACL rules.
For various reasons we don't depend on the underlying OS groups
and instead perform our own group handling.

Users can be made a member of one or more groups by setting the
user.memberOf property within the "users/$who.acl" file:

  [user]
    memberOf = developer
	memberOf = administrator

This will cause the hook to also parse the "groups/$groupname.acl"
file for each value of user.memberOf, and merge any allow rules
that match the current repository with the user's own private rules
(if they had any).

Since some rules are basically the same but may have a component
differ based on the individual user, any user.* key may be inserted
into a rule using the "${user.foo}" syntax.  The allow rule does
not match if the user does not define one (and exactly one) value
for the key "foo".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-10 00:59:43 -07:00
Simon Hausmann ea99c3ae0e git-p4: Fix git-p4 submit to include only changed files in the perforce submit template.
Parse the files section in the "p4 change -o" output and remove lines with file changes in unrelated depot paths.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 13:45:04 -07:00
Simon Hausmann 74276ec6f2 git-p4: Fix support for symlinks.
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Make the mode handling a bit more readable at the same time.

Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 01:58:05 -07:00
Junio C Hamano 2ec39edad9 INSTALL: add warning on docbook-xsl 1.72 and 1.73
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-04 01:55:08 -07:00
Junio C Hamano 7fd53fce1c git-completion: add "git stash"
This is a new addition to 1.5.3; let's teach it to the
completion before the final release.

[sp: Added missing git-stash completion configuration]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-04 03:14:28 -04:00
Han-Wen Nienhuys 7fcff9def5 Fix style nit in Python slicing.
Python slices start at 0 by default.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:28 +02:00
Han-Wen Nienhuys a4eba020f9 Sort output of "p4 change" in incremental import before further
processing

P4 change outputs the changes sorted for each directory separately. We
want the global ordering on the changes, hence we sort.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:25 +02:00
Alexandre Julliard 274e13e0e9 git.el: Take into account the core.excludesfile config option.
Also don't require .git/info/exclude to exist in order to list unknown
files.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Acked-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-31 23:05:43 -07:00
Alexandre Julliard 61988f1127 git.el: Avoid using ewoc-set-data for compatibility with Emacs 21.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Acked-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-31 23:04:10 -07:00
Carlos Rica 2ae68fcb78 Make verify-tag a builtin.
This replaces "git-verify-tag.sh" with "builtin-verify-tag.c".

Testing relies on the "git tag -v" tests calling this command.

A temporary file is needed when calling to gpg, because git is
already creating detached signatures (gpg option -b) to sign tags
(instead of leaving gpg to add the signature to the file by itself),
and those signatures need to be supplied in a separate file to be
verified by gpg.

The program uses git_mkstemp to create that temporary file needed by
gpg, instead of the previously used "$GIT_DIR/.tmp-vtag", in order to
allow the command to be used in read-only repositories, and also
prevent other instances of git to read or remove the same file.

Signal SIGPIPE is ignored because the program sometimes was
terminated because that signal when writing the input for gpg.

The command now can receive many tag names to be verified.
Documentation is also updated here to reflect this new behaviour.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-26 22:51:27 -07:00
Simon Hausmann b2d2d16af7 git-p4: Fix p4 user cache population on Windows.
Fall back to USERPROFILE if HOME isn't set.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 16:06:54 -07:00
Alexandre Julliard ceefa44fe2 git.el: Pass an explicit argument to enable smerge-mode.
Without argument the mode is toggled, which would do the wrong thing
if the file was already open.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 00:06:38 -07:00
Alexandre Julliard 93c22eeb30 git.el: Support for incremental status updates.
When we know which files have been modified, we can now run diff-index
or ls-files with a file list to refresh only the specified files
instead of the whole project.

This also allows proper refreshing of files upon add/delete/resolve,
instead of making assumptions about the new file state.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-24 03:16:26 -07:00
Carlos Rica 62e09ce998 Make git tag a builtin.
This replaces the script "git-tag.sh" with "builtin-tag.c".

The existing test suite for "git tag" guarantees the compatibility
with the features provided by the script version.

There are some minor changes in the behaviour of "git tag" here:
"git tag -v" now can get more than one tag to verify, like "git tag -d" does,
"git tag" with no arguments prints all tags, more like "git branch" does,
and "git tag -n" also prints all tags with annotations (without needing -l).
Tests and documentation were also updated to reflect these changes.

The program is currently calling the script "git verify-tag" for verify.
This can be changed porting it to C and calling its functions directly
from builtin-tag.c.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-20 01:27:25 -07:00
Junio C Hamano 6fb73e442a Merge branch 'master' of git://people.freedesktop.org/~hausmann/git-p4
* 'master' of git://people.freedesktop.org/~hausmann/git-p4:
  git-p4: Cleanup, used common function for listing imported p4 branches
  git-p4: Fix upstream branch detection for submit/rebase with multiple branches.
  git-p4: Cleanup, make listExistingP4Branches a global function for later use.
  git-p4: input to "p4 files" by stdin instead of arguments
  git-p4: use subprocess in p4CmdList
2007-07-18 17:23:03 -07:00
Simon Hausmann 144ff46b19 git-p4: Cleanup, used common function for listing imported p4 branches
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-18 17:29:38 +02:00
Simon Hausmann 86506fe54c git-p4: Fix upstream branch detection for submit/rebase with multiple branches.
Don't use git name-rev to locate the upstream git-p4 branch for rebase and submit but instead locate the branch by comparing the depot paths.
name-rev may produce results like wrongbranch~12 as it uses the first match.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:31 +02:00
Simon Hausmann 062410bb9d git-p4: Cleanup, make listExistingP4Branches a global function for later use.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:05 +02:00
Scott Lamb 788001908c git-p4: input to "p4 files" by stdin instead of arguments
This approach, suggested by Alex Riesen, bypasses the need for xargs-style
argument list handling. The handling in question looks broken in a corner
case with SC_ARG_MAX=4096 and final argument over 96 characters.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:33 +02:00
Scott Lamb 9f90c7335e git-p4: use subprocess in p4CmdList
This allows bidirectional piping - useful for "-x -" to avoid commandline
arguments - and is a step toward bypassing the shell.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:24 +02:00
David Kastrup 99c01de402 contrib/emacs/Makefile: Also install .el files.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-15 20:21:51 -07:00
Sean e3b4968f9c Demote git-p4import to contrib status.
Move git-p4import.py and Documentation/git-p4import.txt into
a contrib/p4import directory.   Add a README there directing
people to contrib/fast-import/git-p4 as a better alternative.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-15 15:23:37 -07:00
Emil Medve 4cb08df553 Use $(RM) in Makefiles instead of 'rm -f'
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 23:31:01 -07:00
Junio C Hamano 3f2fd36ebc Merge branch 'master' of git://repo.or.cz/git/fastimport
* 'master' of git://repo.or.cz/git/fastimport:
  Teach fast-import to recursively copy files/directories
  Fix git-p4 on Windows to not use the Posix sysconf function.
  Correct trivial typo in fast-import documentation
2007-07-14 22:57:47 -07:00
Marius Storm-Olsen 48b4c3d5ab Fix git-p4 on Windows to not use the Posix sysconf function.
Add condition for Windows, since it doesn't support the os.sysconf module.
We hardcode the commandline limit to 2K, as that should work on most
Windows platforms.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-14 22:47:14 -04:00
Junio C Hamano af6861b144 Add contrib/stats/mailmap.pl script
This script reads the existing commit log and .mailmap file,
and outputs author e-mail addresses that would map to more
than one names (most likely due to difference in the way they
are spelled, but some are due to ancient botched commits).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 13:43:49 -07:00
David Kastrup 248c648a0d Add missing functions to contrib/emacs/vc-git.el
This is necessary to make several editing functions work, like
C-u C-x v =

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:38:15 -07:00
Brian Downing b492bbd836 Correct shebang line for contrib/stats/packinfo.pl
"/bin/perl"?  What was I thinking?

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:18:24 -07:00
Nicolas Pitre 750bd6ac35 script to display a distribution of longest common hash prefixes
This script was originally posted on the git mailing list by
Randal L. Schwartz <merlyn@stonehenge.com>.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-12 14:18:15 -07:00
Brian Downing 73f8936050 Pack information tool
This tool will print vaguely pretty information about a pack.  It
expects the output of "git-verify-pack -v" as input on stdin.

$ git-verify-pack -v | packinfo.pl

See the documentation in the script (contrib/stats/packinfo.pl)
for more information.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-11 21:15:23 -07:00
Johannes Schindelin b4372ef136 Enable "git rerere" by the config variable rerere.enabled
Earlier, "git rerere" was enabled by creating the directory
.git/rr-cache.  That is definitely not in line with most other
features, which are enabled by a config variable.

So, check the config variable "rerere.enabled". If it is set
to "false" explicitely, do not activate rerere, even if
.git/rr-cache exists. This should help when you want to disable
rerere temporarily.

If "rerere.enabled" is not set at all, fall back to detection
of the directory .git/rr-cache.

[jc: with minimum tweaks]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06 22:39:15 -07:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00