1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-03 12:16:16 +02:00
Commit Graph

1270 Commits

Author SHA1 Message Date
Pete Wyckoff cb585a9cda git-p4: keyword flattening fixes
Join the text before looking for keywords.  There is nothing to
prevent the p4 output marshaller from splitting in the middle of a
keyword, although it has never been known to happen.

Also remove the (?i) regexp modifier; perforce keywords are
documented as case-sensitive.

Remove the "\n" end-character match.  I don't know why that is
in there, and every keyword in a fairly large production p4 repository
always ends with a $.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff 97a21ca50e git-p4: stop ignoring apple filetype
Currently "apple" filetype is ignored explicitly, and the file is
not even included in the git repository.  This seems wrong.
Remove this, letting it be treated like a "binary" filetype.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff 9cffb8c8bf git-p4: recognize all p4 filetypes
The previous code was approximate in the filetypes it recognized.
Put in the canonical list and be more careful about matching
elements of the file type.

This might change behavior in some cases, hopefully for the
better.  Windows newline mangling will now happen on all
text files.  Previously some like "text+ko" were oddly exempt.

Files with multiple combinations of modifiers, like "text+klx",
are now recognized for keyword expansion.  I expect these to be
seen only rarely.

Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:46:49 -07:00
Pete Wyckoff 55aa5714af git-p4: handle utf16 filetype properly
One of the filetypes that p4 supports is utf16.  Its behavior is
odd in this case.  The data delivered through "p4 -G print" is
not encoded in utf16, although "p4 print -o" will produce the
proper utf16-encoded file.

When dealing with this filetype, discard the data from -G, and
instead read the contents directly.

An alternate approach would be to try to encode the data in
python.  That worked for true utf16 files, but for other files
marked as utf16, p4 delivers mangled text in no recognizable encoding.

Add a test case to check utf16 handling, and +k and +ko handling.

Reported-by: Chris Li <git@chrisli.org>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17 20:45:28 -07:00
Junio C Hamano 2e49dab8a1 Merge branch 'mm/mediawiki-as-a-remote'
* mm/mediawiki-as-a-remote:
  git-remote-mediawiki: allow a domain to be set for authentication
  git-remote-mediawiki: obey advice.pushNonFastForward
  git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts
  git-remote-mediawiki: trivial fixes
  git-remote-mediawiki: allow push to set MediaWiki metadata
  Add a remote helper to interact with mediawiki (fetch & push)
2011-10-05 12:36:27 -07:00
Matthieu Moy 1d6abac9d5 git-remote-mediawiki: allow a domain to be set for authentication
When the wiki uses e.g. LDAP for authentication, the web interface shows
a popup to allow the user to chose an authentication domain, and we need
to use lgdomain in the API at login time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-28 15:20:23 -07:00
Matthieu Moy fd47d7b94d git-remote-mediawiki: obey advice.pushNonFastForward
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:03 -07:00
Matthieu Moy 3c1ed90ec3 git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts
We already have a check that no new revisions are on the wiki at the
beginning of the push, but this didn't handle concurrent accesses to the
wiki.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:02 -07:00
Matthieu Moy ac86ec0f5e git-remote-mediawiki: trivial fixes
Fix a whitespace issue (no space before :) and remove unused %status in
mw_push.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27 11:25:02 -07:00
Gerrit Pape f6f17885ba contrib/hooks: adapt comment about Debian install location for contrib hooks
Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the
first place.  According to the Debian policy they should be located in
/usr/share/git-core/, so let's put them there.

Thanks to Bill Allombert for reporting this through
 http://bugs.debian.org/640949

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26 16:39:34 -07:00
Matthieu Moy 93f0d33818 git-remote-mediawiki: allow push to set MediaWiki metadata
Push can not set the commit note "mediawiki_revision:" and update the
remote reference. This avoids having to "git pull --rebase" after each
push, and is probably more natural. Make it the default, but let it be
configurable with mediawiki.dumbPush or remote.<remotename>.dumbPush.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-01 15:52:57 -07:00
Jeremie Nikaes 428c995c4e Add a remote helper to interact with mediawiki (fetch & push)
Implement a gate between git and mediawiki, allowing git users to push
and pull objects from mediawiki just as one would do with a classic git
repository thanks to remote-helpers.

The following packages need to be installed (available on common
repositories):

  libmediawiki-api-perl
  libdatetime-format-iso8601-perl

Use remote helpers in order to be as transparent as possible to the git
user.

Download Mediawiki revisions through the Mediawiki API and then
fast-import into git.

Mediawiki revision number and git commits are linked thanks to notes
bound to commits.

The import part is done on a refs/mediawiki/<remote> branch before
coming to refs/remote/origin/master (Huge thanks to Jonathan Nieder
for his help)

We use UTF-8 everywhere: use encoding 'utf8'; does most of the job, but
we also read the output of Git commands in UTF-8 with the small helper
run_git, and write to the console (STDERR) in UTF-8. This allows a
seamless use of non-ascii characters in page titles, but hasn't been
tested on non-UTF-8 systems. In particular, UTF-8 encoding for filenames
could raise problems if different file systems handle UTF-8 filenames
differently. A uri_escape of mediawiki filenames could be imaginable, and
is still to be discussed further.

Partial cloning is supported using one of:

git clone -c remote.origin.pages='A_Page  Another_Page' mediawiki::http://wikiurl

git clone -c remote.origin.categories='Some_Category' mediawiki::http://wikiurl

git clone -c remote.origin.shallow='True' mediawiki::http://wikiurl

Thanks to notes metadata, it is possible to compare remote and local last
mediawiki revision to warn non-fast forward pushes and "everything
up-to-date" case.

When allowed, push looks for each commit between remotes/origin/master
and HEAD, catches every blob related to these commit and push them in
chronological order. To do so, it uses git rev-list --children HEAD and
travels the tree from remotes/origin/master to HEAD through children. In
other words:

* Shortest path from remotes/origin/master to HEAD
* For each commit encountered, push blobs related to this commit

Signed-off-by: Jérémie Nikaes <jeremie.nikaes@ensimag.imag.fr>
Signed-off-by: Arnaud Lacurie <arnaud.lacurie@ensimag.imag.fr>
Signed-off-by: Claire Fousse <claire.fousse@ensimag.imag.fr>
Signed-off-by: David Amouyal <david.amouyal@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Sylvain Boulmé <sylvain.boulme@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-01 15:52:55 -07:00
Junio C Hamano cfd2f0f558 Merge branch 'va/p4-branch-import'
* va/p4-branch-import:
  git-p4: Add simple test case for branch import
  git-p4: Allow branch definition with git config
  git-p4: Allow filtering Perforce branches by user
  git-p4: Correct branch base depot path detection
  git-p4: Process detectCopiesHarder with --bool
  git-p4: Add test case for copy detection
  git-p4: Add test case for rename detection
  git-p4: Add description of rename/copy detection options
  git-p4: Allow setting rename/copy detection threshold
2011-08-28 21:15:34 -07:00
Vitor Antunes 7199cf131c git-p4: Allow branch definition with git config
Perforce does not strictly require the usage of branch specifications to create
branches. In these cases the branch detection code of git-p4 will not be able to
import them.
This patch adds support for git-p4.branchList configuration option, allowing
branches to be defined in git config.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00
Vitor Antunes 8ace74c00e git-p4: Allow filtering Perforce branches by user
All branches in the Perforce server are downloaded to allow branch detection. If
you have a centralized server on a remote location and there is a big number of
branches this operation can take some time.
This patch adds the configuration option git-p4.branchUser to allow filtering
the branch list by user. Although this limits the branch maintenance in Perforce
to be done by a single user, it might be an advantage when the number of
branches being used in a specific depot is very small when compared with the
branches available in the server.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00
Vitor Antunes 04d277b39e git-p4: Correct branch base depot path detection
When branch detection is enabled each branch is named in git after their
relative depot path in Perforce. To do this the depot paths are compared against
each other to find their common base path. The current algorithm makes this
comparison on a character by character basis.
Assuming we have the following branches:

  //depot/branches/featureA
  //depot/branches/featureB

Then the base depot path would be //depot/branches/feature, which is an invalid
depot path.

The current patch fixes this by splitting the path into a list and comparing the
list entries, making it choose correctly //depot/branches as the base path.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 21:08:37 -07:00
Vitor Antunes 68cbcf1b25 git-p4: Process detectCopiesHarder with --bool
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 11:50:43 -07:00
Vitor Antunes 807371a926 git-p4: Add description of rename/copy detection options
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 11:49:04 -07:00
Vitor Antunes 0a9feffc47 git-p4: Allow setting rename/copy detection threshold
Copy and rename detection arguments (-C and -M) allow setting a threshold value
for the similarity ratio. If the similarity is below this threshold the rename
or copy is ignored and the file is added as new.
This patch allows setting git-p4.detectRenames and git-p4.detectCopies options
to an integer value to set the respective threshold.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 11:48:38 -07:00
Junio C Hamano 6ed547b53b Merge branch 'js/ref-namespaces'
* js/ref-namespaces:
  ref namespaces: tests
  ref namespaces: documentation
  ref namespaces: Support remote repositories via upload-pack and receive-pack
  ref namespaces: infrastructure
  Fix prefix handling in ref iteration functions
2011-08-17 17:35:38 -07:00
Jon Jensen 0d7c01c991 Add option hooks.diffopts to customize change summary in post-receive-email
This makes it easy to customize the git diff-tree options, for example
to include -p to include inline diffs.

It defaults to the current options "--stat --summary --find-copies-harder"
and thus is backward-compatible.

Signed-off-by: Jon Jensen <jon@endpoint.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 12:06:49 -07:00
Pete Wyckoff 4e2e6ce450 git-p4: commit time should be most recent p4 change time
When importing a repo, the time on the initial commit had been
just "now".  But this causes problems when trying to share among
git-p4 repos that were created identically, although at different
times.  Instead, use the time in the top-most p4 change as the
time for the git import commit.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:24:20 -07:00
Josh Triplett d49483f0ca ref namespaces: documentation
Document the namespace mechanism in a new gitnamespaces(7) page.
Reference it from receive-pack and upload-pack.

Document the new --namespace option and GIT_NAMESPACE environment
variable in git(1), and reference gitnamespaces(7).

Add a sample Apache configuration to http-backend(1) to support
namespaced repositories, and reference gitnamespaces(7).

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-11 09:35:46 -07:00
Martin von Zweigbergk 7791a1d9b9 Documentation: use [verse] for SYNOPSIS sections
The SYNOPSIS sections of most commands that span several lines already
use [verse] to retain line breaks. Most commands that don't span
several lines seem not to use [verse]. In the HTML output, [verse]
does not only preserve line breaks, but also makes the section
indented, which causes a slight inconsistency between commands that
use [verse] and those that don't. Use [verse] in all SYNOPSIS sections
for consistency.

Also remove the blank lines from git-fetch.txt and git-rebase.txt to
align with the other man pages. In the case of git-rebase.txt, which
already uses [verse], the blank line makes the [verse] not apply to
the last line, so removing the blank line also makes the formatting
within the document more consistent.

While at it, add single quotes to 'git cvsimport' for consistency with
other commands.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 14:26:26 -07:00
Josh Triplett a1bea2c1fc ref namespaces: infrastructure
Add support for dividing the refs of a single repository into multiple
namespaces, each of which can have its own branches, tags, and HEAD.
Git can expose each namespace as an independent repository to pull from
and push to, while sharing the object store, and exposing all the refs
to operations such as git-gc.

Storing multiple repositories as namespaces of a single repository
avoids storing duplicate copies of the same objects, such as when
storing multiple branches of the same source.  The alternates mechanism
provides similar support for avoiding duplicates, but alternates do not
prevent duplication between new objects added to the repositories
without ongoing maintenance, while namespaces do.

To specify a namespace, set the GIT_NAMESPACE environment variable to
the namespace.  For each ref namespace, git stores the corresponding
refs in a directory under refs/namespaces/.  For example,
GIT_NAMESPACE=foo will store refs under refs/namespaces/foo/.  You can
also specify namespaces via the --namespace option to git.

Note that namespaces which include a / will expand to a hierarchy of
namespaces; for example, GIT_NAMESPACE=foo/bar will store refs under
refs/namespaces/foo/refs/namespaces/bar/.  This makes paths in
GIT_NAMESPACE behave hierarchically, so that cloning with
GIT_NAMESPACE=foo/bar produces the same result as cloning with
GIT_NAMESPACE=foo and cloning from that repo with GIT_NAMESPACE=bar.  It
also avoids ambiguity with strange namespace paths such as
foo/refs/heads/, which could otherwise generate directory/file conflicts
within the refs directory.

Add the infrastructure for ref namespaces: handle the GIT_NAMESPACE
environment variable and --namespace option, and support iterating over
refs in a namespace.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 11:19:24 -07:00
Junio C Hamano 568d44641b Merge branch 'maint'
* maint:
  completion: replace core.abbrevguard to core.abbrev
2011-06-26 12:09:11 -07:00
Junio C Hamano 99ac63b092 Merge branch 'maint-1.7.4' into maint
* maint-1.7.4:
  completion: replace core.abbrevguard to core.abbrev
2011-06-24 09:40:02 -07:00
Namhyung Kim cdb791f61d completion: replace core.abbrevguard to core.abbrev
The core.abbrevguard config variable had removed and
now core.abbrev has been used instead. Teach it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-24 09:35:44 -07:00
Junio C Hamano be653d6cb8 Merge branch 'mk/grep-pcre'
* mk/grep-pcre:
  git-grep: Fix problems with recently added tests
  git-grep: Update tests (mainly for -P)
  Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
  git-grep: update tests now regexp type is "last one wins"
  git-grep: do not die upon -F/-P when grep.extendedRegexp is set.
  git-grep: Bail out when -P is used with -F or -E
  grep: Add basic tests
  configure: Check for libpcre
  git-grep: Learn PCRE
  grep: Extract compile_regexp_failed() from compile_regexp()
  grep: Fix a typo in a comment
  grep: Put calls to fixmatch() and regmatch() into patmatch()
  contrib/completion: --line-number to git grep
  Documentation: Add --line-number to git-grep synopsis
2011-05-30 00:00:07 -07:00
Junio C Hamano 87a684fc53 Merge branch 'ld/p4-preserve-user-names'
* ld/p4-preserve-user-names:
  git-p4: warn if git authorship won't be retained
  git-p4: small improvements to user-preservation
  git-p4: add option to preserve user names
2011-05-19 20:37:20 -07:00
Junio C Hamano 0184435268 Merge branch 'sg/completion-updates'
* sg/completion-updates:
  Revert "completion: don't declare 'local words' to make zsh happy"
  git-completion: fix regression in zsh support
  completion: move private shopt shim for zsh to __git_ namespace
  completion: don't declare 'local words' to make zsh happy
2011-05-16 16:47:00 -07:00
Luke Diamand 848de9c383 git-p4: warn if git authorship won't be retained
If the git commits you are submitting contain changes made by
other people, the authorship will not be retained. Change git-p4
to warn of this and to note that --preserve-user can be used
to solve the problem (if you have suitable permissions).
The warning can be disabled.

Add a test case and update documentation.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-13 12:59:13 -07:00
Junio C Hamano 2df7683b6e Merge branch 'fc/completion-zsh' into sg/completion-updates
* fc/completion-zsh:
  git-completion: fix regression in zsh support
2011-05-10 13:14:58 -07:00
Junio C Hamano 1a0c9a305f Revert "completion: don't declare 'local words' to make zsh happy"
This reverts commit 3bee6a4733, as the fix
that will be used by upstream zsh folks should make it unnecessary.
2011-05-10 13:13:50 -07:00
Felipe Contreras 52fd972d59 git-completion: fix regression in zsh support
The zsh support of git-completion script in contrib/ is broken for current
versions of zsh, and does not notice when there's a subcommand.

For example: "git log origi<TAB>" gives no completions because it would
try to find a "git origi..." command. This will be fixed by zsh 4.3.12,
but for now we can workaround it by backporting the same fix as zsh folks
implemented.

The problem started after commit v1.7.4-rc0~11^2~2 (bash: get
--pretty=m<tab> completion to work with bash v4), which introduced
_get_comp_words_by_ref() that comes from bash-completion[1] scripts, and
relies on the 'words' variable.

However, it turns out 'words' is a special variable used by zsh
completion. From zshcompwid(1):

  [...] the parameters are reset on each function exit (including nested
  function calls from within the completion widget) to the values they had
  when the function was entered.

As a result, subcommand words are lost.  Ouch.

This is now fixed in the latest master branch of zsh[2] by simply defining
'words' as hidden (typeset -h), which removes the special meaning inside
the emulated bash function. So let's do the same.

Jonathan Nieder helped on the commit message.

  [1] http://bash-completion.alioth.debian.org/
  [2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=e880604f029088f32fb1ecc39213d720ae526aaa

Reported-by: Stefan Haller <lists@haller-berlin.de>
Comments-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-10 13:08:51 -07:00
Michał Kiedrowicz 63e7e9d8b6 git-grep: Learn PCRE
This patch teaches git-grep the --perl-regexp/-P options (naming
borrowed from GNU grep) in order to allow specifying PCRE regexes on the
command line.

PCRE has a number of features which make them more handy to use than
POSIX regexes, like consistent escaping rules, extended character
classes, ungreedy matching etc.

git isn't build with PCRE support automatically. USE_LIBPCRE environment
variable must be enabled (like `make USE_LIBPCRE=YesPlease`).

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 16:29:33 -07:00
Luke Diamand ecdba36da6 git-p4: small improvements to user-preservation
. Slightly more paranoid checking of results from 'p4 change'
. Remove superfluous "-G"
. Don't modify the username if it is unchanged.
. Add a comment in the change template to show what is
  going to be done.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-By: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 16:26:51 -07:00
Jonathan Nieder dad4277529 completion: move private shopt shim for zsh to __git_ namespace
Most zsh users probably probably do not expect a custom shopt function
to enter their environment just because they ran "source
~/.git-completion.sh".

Such namespace pollution makes development of other scripts confusing
(because it makes the bash-specific shopt utility seem to be available
in zsh) and makes git's tab completion script brittle (since any other
shell snippet implementing some other subset of shopt will break it).
Rename the shopt shim to the more innocuous __git_shopt to be a good
citizen (with two underscores to avoid confusion with completion rules
for a hypothetical "git shopt" command).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08 21:08:13 -07:00
Junio C Hamano 6975ecadd7 Merge branch 'sg/completion-cleanup'
* sg/completion-cleanup:
  completion: remove unnecessary _get_comp_words_by_ref() invocations
  completion: don't modify the $cur variable in completion functions
2011-05-06 10:52:03 -07:00
Michał Kiedrowicz 5a69eaf554 contrib/completion: --line-number to git grep
The "-n" option of "git grep" gained a synonym "--line-number" with
commit 7d6cb10b ("grep: Add the option '--line-number'", 2011-03-28).

Teach bash-completion about it.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-05 08:34:13 -07:00
Junio C Hamano 23f536cf62 Merge branch 'jk/notes-ui-updates'
* jk/notes-ui-updates:
  contrib/completion: --notes, --no-notes
  log/pretty-options: Document --[no-]notes and deprecate old notes options
  revision.c: make --no-notes reset --notes list
  revision.c: support --notes command-line option
  notes: refactor display notes default handling
  notes: refactor display notes extra refs field
  revision.c: refactor notes ref expansion
  notes: make expand_notes_ref globally accessible
2011-05-02 15:58:50 -07:00
SZEDER Gábor 3bee6a4733 completion: don't declare 'local words' to make zsh happy
The "_get_comp_words_by_ref -n := words" command from the
bash_completion library reassembles a modified version of COMP_WORDS
with ':' and '=' no longer treated as word separators and stores it in
the ${words[@]} array.  Git's programmable tab completion script uses
this to abstract away the difference between bash v3's and bash v4's
definitions of COMP_WORDS (bash v3 used shell words, while bash v4
breaks at separator characters); see v1.7.4-rc0~11^2~2 (bash: get
--pretty=m<tab> completion to work with bash v4, 2010-12-02).

zsh has (or rather its completion functions have) another idea about
what ${words[@]} should contain: the array is prepopulated with the
words from the command it is completing.  For reasons that are not
well understood, when git-completion.bash reserves its own "words"
variable with "local words", the variable becomes empty and cannot be
changed from then on.  So the completion script neglects the arguments
it has seen, and words complete like git subcommand names.  For
example, typing "git log origi<TAB>" gives no completions because
there are no "git origi..." commands.

However, when this words variable is not declared as local but is just
populated by _get_comp_words_by_ref() and then read in various
completion functions, then zsh seems to be happy about it and our
completion script works as expected.

So, to get our completion script working again under zsh and to
prevent the words variable from leaking into the shell environment
under bash, we will only declare words as local when using bash.

Reported-by: Stefan Haller <lists@haller-berlin.de>
Suggested-by: Felipe Contreras <felipe.contreras@gmail.com>
Explained-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28 09:40:21 -07:00
SZEDER Gábor da4902a730 completion: remove unnecessary _get_comp_words_by_ref() invocations
In v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work
with bash v4, 2010-12-02) we started to use _get_comp_words_by_ref()
to access completion-related variables.  That was large change, and to
make it easily reviewable, we invoked _get_comp_words_by_ref() in each
completion function and systematically replaced every occurance of
bash's completion-related variables ($COMP_WORDS and $COMP_CWORD) with
variables set by _get_comp_words_by_ref().

This has the downside that _get_comp_words_by_ref() is invoked several
times during a single completion.  The worst offender is perhaps 'git
log mas<TAB>': during the completion of 'master'
_get_comp_words_by_ref() is invoked no less than six times.

However, the variables $prev, $cword, and $words provided by
_get_comp_words_by_ref() are not modified in any of the completion
functions, and the previous commit ensures that the $cur variable is
not modified as well.  This makes it possible to invoke
_get_comp_words_by_ref() to get those variables only once in our
toplevel completion functions _git() and _gitk(), and all other
completion functions will inherit them.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28 09:40:20 -07:00
SZEDER Gábor 9244d69b96 completion: don't modify the $cur variable in completion functions
Since v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work
with bash v4, 2010-12-02) we use _get_comp_words_by_ref() to access
completion-related variables, and the $cur variable holds the word
containing the current cursor position in all completion functions.
This $cur variable is left unchanged in most completion functions;
there are only four functions modifying its value, namely __gitcomp(),
__git_complete_revlist_file(), __git_complete_remote_or_refspec(), and
_git_config().

If this variable were never modified, then it would allow us a nice
optimisation and cleanup.  Therefore, this patch assigns $cur to an
other local variable and uses that for later modifications in those
four functions.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28 09:40:20 -07:00
Marius Storm-Olsen b5a49471f0 Automatically autoload bashcompinit for ZSH, when needed
If bashcompinit has not already been autoloaded, do so
automatically, as it is required to properly parse the
git-completion file with ZSH.

Helped-by: Felipe Contreras
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-27 10:48:20 -07:00
Luke Diamand 3ea2cfd488 git-p4: add option to preserve user names
Patches from git passed into p4 end up with the committer being identified
as the person who ran git-p4.

With "submit --preserve-user", git-p4 modifies the p4 changelist (after it
has been submitted), setting the p4 author field.

The submitter is required to have sufficient p4 permissions or git-p4
refuses to proceed. If the git author is not known to p4, the submit will
be abandoned unless git-p4.allowMissingP4Users is true.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-26 11:10:46 -07:00
Michael J Gruber 3925b57568 contrib/completion: --notes, --no-notes
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-14 12:24:18 -07:00
Andrew Garber c3f6163b0b git-p4: replace each tab with 8 spaces for consistency
Note that the majority of git-p4 uses spaces, not tabs, for indentation.
Consistent indentation is a good hygiene for Python scripts, and mixing
tabs and spaces in Python can lead to hard-to-find bugs.

Signed-off-by: Andrew Garber <andrew@andrewgarber.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-07 00:37:45 -07:00
Lawrence Mitchell 485cdb9bd8 git.el: Don't use font-lock-compile-keywords
If font-lock is disabled, font-lock-compile-keywords complains.
Really what we want to do is to replace log-edit's font-lock
definitions with our own, so define a major mode deriving from
log-edit and set up font-lock-defaults there.  We then use the
optional MODE argument to log-edit to set up the major mode of the
commit buffer appropriately.

Signed-off-by: Lawrence Mitchell <wence@gmx.li>
Acked-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-03 11:08:54 -07:00
Junio C Hamano 17a0299807 Merge branch 'maint'
* maint:
  contrib/thunderbird-patch-inline: do not require bash to run the script
  t8001: check the exit status of the command being tested
  strbuf.h: remove a tad stale docs-in-comment and reference api-doc instead
  Typos: t/README
  Documentation/config.txt: make truth value of numbers more explicit
  git-pack-objects.txt: fix grammatical errors
  parse-remote: replace unnecessary sed invocation
2011-03-30 14:10:41 -07:00