Commit graph

1626 commits

Author SHA1 Message Date
Karsten Blees 8b2d219a3d wincred: improve compatibility with windows versions
On WinXP, the windows credential helper doesn't work at all (due to missing
Cred[Un]PackAuthenticationBuffer APIs). On Win7, the credential format used
by wincred is incompatible with native Windows tools (such as the control
panel applet or 'cmdkey.exe /generic'). These Windows tools only set the
TargetName, UserName and CredentialBlob members of the CREDENTIAL
structure (where CredentialBlob is the UTF-16-encoded password).

Remove the unnecessary packing / unpacking of the password, along with the
related API definitions, for compatibility with Windows XP.

Don't use CREDENTIAL_ATTRIBUTEs to identify credentials for compatibility
with Windows credential manager tools. Parse the protocol, username, host
and path fields from the credential's target name instead.

Credentials created with an old wincred version will have mangled or empty
passwords after this change.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2013-02-26 17:42:46 +01:00
Karsten Blees 3b12f46ab3 wincred: accept CRLF on stdin to simplify console usage
The windows credential helper currently only accepts LF on stdin, but bash
and cmd.exe both send CRLF. This prevents interactive use in the console.

Change the stdin parser to optionally accept CRLF.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2013-02-26 17:42:24 +01:00
Martin Erik Werner 31e6a4e613 shell-prompt: clean up nested if-then
Minor clean up of if-then nesting in checks for environment variables
and config options. No functional changes.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-18 15:33:31 -08:00
Junio C Hamano abea4dc76a Merge branch 'mp/diff-algo-config'
Add diff.algorithm configuration so that the user does not type
"diff --histogram".

* mp/diff-algo-config:
  diff: Introduce --diff-algorithm command line option
  config: Introduce diff.algorithm variable
  git-completion.bash: Autocomplete --minimal and --histogram for git-diff
2013-02-17 15:25:52 -08:00
Junio C Hamano adbbc6f291 Merge branch 'mw/bash-prompt-show-untracked-config'
Allows skipping the untracked check GIT_PS1_SHOWUNTRACKEDFILES
asks for the git-prompt (in contrib/) per repository.

* mw/bash-prompt-show-untracked-config:
  t9903: add extra tests for bash.showDirtyState
  t9903: add tests for bash.showUntrackedFiles
  shell prompt: add bash.showUntrackedFiles option
2013-02-17 15:25:46 -08:00
Junio C Hamano b1bcb973af Merge branch 'mm/config-local-completion'
* mm/config-local-completion:
  completion: support 'git config --local'
2013-02-14 16:06:19 -08:00
Junio C Hamano 97a8f025e5 Merge branch 'mm/remote-mediawiki-build'
* mm/remote-mediawiki-build:
  git-remote-mediawiki: use toplevel's Makefile
  Makefile: make script-related rules usable from subdirectories
2013-02-14 10:29:49 -08:00
Junio C Hamano 260adc87b3 Merge branch 'dg/subtree-fixes'
contrib/subtree updates, but here are only the ones that looked
ready.  The remainder of the patches will have another day.

* dg/subtree-fixes:
  contrib/subtree: make the manual directory if needed
  contrib/subtree: honor DESTDIR
  contrib/subtree: fix synopsis
  contrib/subtree: better error handling for 'subtree add'
  contrib/subtree: use %B for split subject/body
  contrib/subtree: remove test number comments
2013-02-14 10:28:26 -08:00
Martin Erik Werner 66cb5d4420 shell prompt: add bash.showUntrackedFiles option
Add a config option 'bash.showUntrackedFiles' which allows enabling
the prompt showing untracked files on a per-repository basis. This is
useful for some repositories where the 'git ls-files ...' command may
take a long time.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-13 08:06:57 -08:00
Matthieu Moy 66c0786ca5 completion: support 'git config --local'
This needs to be done in two places: __git_config_get_set_variables to
allow clever completion of "git config --local --get foo<tab>", and
_git_config to allow "git config --loc<tab>" to complete to --local.

While we're there, change the order of options in the code to match
git-config.txt.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-12 10:06:25 -08:00
Junio C Hamano d03d820a8c Merge branch 'mk/tcsh-complete-only-known-paths'
The "complete with known paths only" update to completion scripts
returns directory names without trailing slash to compensate the
addition of '/' done by bash that reads from our completion result.
tcsh completion code that reads from our internal completion result
does not add '/', so let it ask our complletion code to keep the '/'
at the end.

* mk/tcsh-complete-only-known-paths:
  completion: handle path completion and colon for tcsh script
2013-02-08 15:28:51 -08:00
Junio C Hamano d931e2fb25 Merge branch 'mp/complete-paths'
The completion script used to let the default completer to suggest
pathnames, which gave too many irrelevant choices (e.g. "git add"
would not want to add an unmodified path).  Teach it to use a more
git-aware logic to enumerate only relevant ones.

* mp/complete-paths:
  git-completion.bash: add support for path completion
2013-02-08 15:28:42 -08:00
Matthieu Moy 1986768f9c git-remote-mediawiki: use toplevel's Makefile
This makes the Makefile simpler, while providing more features, and more
consistency (the exact same rules with the exact same configuration as
Git official commands are applied with the new version).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-08 10:02:32 -08:00
Jesper L. Nielsen 8165be064e contrib/subtree: make the manual directory if needed
Before install git-subtree documentation, make sure the manpage
directory exists.

Signed-off-by: Jesper L. Nielsen <lyager@gmail.com>
Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:23:41 -08:00
Adam Tkac d86848228f contrib/subtree: honor DESTDIR
Teach git-subtree's Makefile to honor DESTDIR.

Signed-off-by: Adam Tkac <atkac@redhat.com>
Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:23:19 -08:00
David A. Greene 111dc0eea0 contrib/subtree: fix synopsis
Fix the documentation of add to show that a repository can be
specified along with a commit.

Suggested by Yann Dirson <dirson@bertin.fr>.

Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:23:05 -08:00
David A. Greene 10a49587fa contrib/subtree: better error handling for 'subtree add'
Check refspecs for validity before passing them on to other commands.
This lets us generate more helpful error messages.

Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:22:36 -08:00
Techlive Zheng a5b8e28e4e contrib/subtree: use %B for split subject/body
Use %B to format the commit message and body to avoid an extra newline
if a commit only has a subject line.

Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>
Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:22:12 -08:00
David A. Greene 144797d720 contrib/subtree: remove test number comments
Delete the comments indicating test numbers as it causes maintenance
headaches.  t*.sh -i will help us find any broken tests and these
numbers are not helping us anyway.

Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05 15:19:35 -08:00
Junio C Hamano 3e515b0d40 Merge branch 'jk/remote-helpers-in-python-3'
Prepare remote-helper test written in Python to be run with Python3.

* jk/remote-helpers-in-python-3:
  git_remote_helpers: remove GIT-PYTHON-VERSION upon "clean"
  git-remote-testpy: fix path hashing on Python 3
  git-remote-testpy: call print as a function
  git-remote-testpy: don't do unbuffered text I/O
  git-remote-testpy: hash bytes explicitly
  svn-fe: allow svnrdump_sim.py to run with Python 3
  git_remote_helpers: use 2to3 if building with Python 3
  git_remote_helpers: force rebuild if python version changes
  git_remote_helpers: fix input when running under Python 3
  git_remote_helpers: allow building with Python 3
2013-02-04 10:25:34 -08:00
Marc Khouzam c6929ff239 completion: handle path completion and colon for tcsh script
Recent enhancements to git-completion.bash provide intelligent path
completion for git commands.  Such completions do not provide the
'/' at the end of directories for recent versions of bash; instead,
bash itself will add the trailing slash to directories to the result
provided by git-completion.bash.  However, the completion for tcsh
uses the result of the bash completion script directly, so it either
needs to add the necessary slash itself, or needs to ask the bash
script to keep the trailing slash.

Adding the slash itself is difficult because we have to check the
each path in the output of the bash script to see if it is meant to
be a directory or something else.  For example, assuming there is a
directory named 'commit' in the current directory, then, when
completing

  git add commit<tab>

we would need to add a slash, but for

  git help commit<tab>

we should not.

Figuring out such differences would require adding much intelligence
to the tcsh completion script.  Instead, it is simpler to ask the
bash script to keep the trailing slash.  This patch does this.

Also, tcsh does not handle the colon as a completion separator so we
remove it from the list of separators.

Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
2013-02-03 18:59:34 -08:00
Junio C Hamano 51a1d232a7 Merge branch 'jc/do-not-let-random-file-interfere-with-completion-tests'
Scripts to test bash completion was inherently flaky as it was
affected by whatever random things the user may have on $PATH.

* jc/do-not-let-random-file-interfere-with-completion-tests:
  t9902: protect test from stray build artifacts
2013-02-01 12:39:46 -08:00
Junio C Hamano 38f7636410 Merge branch 'bc/fix-array-syntax-for-3.0-in-completion-bash'
Fix use of an array notation that older versions of bash do not
understand.

* bc/fix-array-syntax-for-3.0-in-completion-bash:
  git-completion.bash: replace zsh notation that breaks bash 3.X
2013-01-28 10:59:07 -08:00
John Keeping cadbf5c7ed svn-fe: allow svnrdump_sim.py to run with Python 3
The changes to allow this script to run with Python 3 are minimal and do
not affect its functionality on the versions of Python 2 that are
already supported (2.4 onwards).

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24 19:32:35 -08:00
Junio C Hamano 5047822347 t9902: protect test from stray build artifacts
When you have random build artifacts in your build directory, left
behind by running "make" while on another branch, the "git help -a"
command run by __git_list_all_commands in the completion script that
is being tested does not have a way to know that they are not part
of the subcommands this build will ship.  Such extra subcommands may
come from the user's $PATH.  They will interfere with the tests that
expect a certain prefix to uniquely expand to a known completion.

Instrument the completion script and give it a way for us to tell
what (subset of) subcommands we are going to ship.

Also add a test to "git --help <prefix><TAB>" expansion.  It needs
to show not just commands but some selected documentation pages.

Based on an idea by Jeff King.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24 15:08:37 -08:00
Junio C Hamano 86db746449 Merge branch 'ch/add-auto-submitted-in-sample-post-receive-email'
* ch/add-auto-submitted-in-sample-post-receive-email:
  Add Auto-Submitted header to post-receive-email
2013-01-23 21:19:19 -08:00
Junio C Hamano a39b15b4f6 Merge branch 'as/check-ignore'
Add a new command "git check-ignore" for debugging .gitignore
files.

The variable names may want to get cleaned up but that can be done
in-tree.

* as/check-ignore:
  clean.c, ls-files.c: respect encapsulation of exclude_list_groups
  t0008: avoid brace expansion
  add git-check-ignore sub-command
  setup.c: document get_pathspec()
  add.c: extract new die_if_path_beyond_symlink() for reuse
  add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
  pathspec.c: rename newly public functions for clarity
  add.c: move pathspec matchers into new pathspec.c for reuse
  add.c: remove unused argument from validate_pathspec()
  dir.c: improve docs for match_pathspec() and match_pathspec_depth()
  dir.c: provide clear_directory() for reclaiming dir_struct memory
  dir.c: keep track of where patterns came from
  dir.c: use a single struct exclude_list per source of excludes

Conflicts:
	builtin/ls-files.c
	dir.c
2013-01-23 21:19:10 -08:00
Junio C Hamano 864b5c41e4 Merge branch 'mh/remote-hg-mode-bits-fix'
Update to the Hg remote helper (in contrib/).

* mh/remote-hg-mode-bits-fix:
  remote-hg: fix handling of file perms when pushing
2013-01-21 20:15:40 -08:00
Junio C Hamano 9a69ef1e70 Merge branch 'fc/remote-hg-fixup-url'
Update to the Hg remote helper (in contrib/).

* fc/remote-hg-fixup-url:
  remote-hg: store converted URL
2013-01-21 20:15:32 -08:00
Brandon Casey 50c5885e05 git-completion.bash: replace zsh notation that breaks bash 3.X
When commit d8b45314 began separating the zsh completion from the bash
completion, it introduced a zsh completion "bridge" section into the bash
completion script for zsh users to use until they migrated to the zsh
script.  The zsh '+=()' append-to-array notation prevents bash 3.00.15 on
CentOS 4.x from loading the completion script and breaks test 9902.  We can
easily work around this by using standard Bash array notation.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-18 12:16:38 -08:00
Junio C Hamano 7829253684 Merge branch 'ds/completion-silence-in-tree-path-probe'
An internal ls-tree call made by completion code only to probe if
a path exists in the tree recorded in a commit object leaked error
messages when the path is not there.  It is not an error at all and
should not be shown to the end user.

* ds/completion-silence-in-tree-path-probe:
  git-completion.bash: silence "not a valid object" errors
2013-01-18 11:20:03 -08:00
Junio C Hamano bd2734ae0d Merge branch 'jn/maint-trim-vim-contrib'
Remove instructions for old vim support, which is better described
in the upstream vim documentation.

* jn/maint-trim-vim-contrib:
  contrib/vim: simplify instructions for old vim support
2013-01-18 11:19:39 -08:00
Junio C Hamano 3a1bba7e38 Merge branch 'mk/complete-tcsh'
Update tcsh command line completion so that an unwanted space is
not added to a single directory name.

* mk/complete-tcsh:
  Prevent space after directories in tcsh completion
2013-01-18 11:19:28 -08:00
Chris Hiestand 7811aabbe7 Add Auto-Submitted header to post-receive-email
This conforms to RFC3834 and is useful in preventing eg
vacation auto-responders from replying by default

Signed-off-by: Chris Hiestand <chiestand@salk.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-17 12:47:27 -08:00
Michal Privoznik 07924d4d50 diff: Introduce --diff-algorithm command line option
Since command line options have higher priority than config file
variables and taking previous commit into account, we need a way
how to specify myers algorithm on command line. However,
inventing `--myers` is not the right answer. We need far more
general option, and that is `--diff-algorithm`.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-16 09:41:18 -08:00
Michal Privoznik 07ab4dec80 config: Introduce diff.algorithm variable
Some users or projects prefer different algorithms over others, e.g.
patience over myers or similar. However, specifying appropriate
argument every time diff is to be used is impractical. Moreover,
creating an alias doesn't play nicely with other tools based on diff
(git-show for instance). Hence, a configuration variable which is able
to set specific algorithm is needed. For now, these four values are
accepted: 'myers' (which has the same effect as not setting the config
variable at all), 'minimal', 'patience' and 'histogram'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-16 09:37:45 -08:00
Max Horn 3968e302f8 remote-hg: fix handling of file perms when pushing
Previously, when changing and committing an executable file, the file
would loose its executable bit on the hg side. Likewise, symlinks ended
up as "normal" files". This was not immediately apparent on the git side
unless one did a fresh clone.

Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15 10:01:11 -08:00
Felipe Contreras e6bc8a3328 remote-hg: store converted URL
Mercurial might convert the URL to something more appropriate, like an
absolute path. Lets store that instead of the original URL, which won't
work from a different working directory if it's relative.

Suggested-by: Max Horn <max@quendi.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15 09:57:57 -08:00
Michal Privoznik 216120ab83 git-completion.bash: Autocomplete --minimal and --histogram for git-diff
Even though --patience was already there, we missed --minimal and
--histogram for some reason.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-14 10:31:13 -08:00
Junio C Hamano dca93d2b01 Merge branch 'jk/complete-commit-c' into maint
* jk/complete-commit-c:
  completion: complete refs for "git commit -c"
2013-01-14 08:02:35 -08:00
Manlio Perillo fea16b47b6 git-completion.bash: add support for path completion
The git-completion.bash script did not implemented full, git aware,
support to complete paths, for git commands that operate on files within
the current working directory or the index.

As an example:

	git add <TAB>

will suggest all files in the current working directory, including
ignored files and files that have not been modified.

Support path completion, for git commands where the non-option arguments
always refer to paths within the current working directory or the index,
as follows:

* the path completion for the "git rm" and "git ls-files"
  commands will suggest all cached files.

* the path completion for the "git add" command will suggest all
  untracked and modified files.  Ignored files are excluded.

* the path completion for the "git clean" command will suggest all
  untracked files.  Ignored files are excluded.

* the path completion for the "git mv" command will suggest all cached
  files when expanding the first argument, and all untracked and cached
  files for subsequent arguments.  In the latter case, empty directories
  are included and ignored files are excluded.

* the path completion for the "git commit" command will suggest all
  files that have been modified from the HEAD, if HEAD exists, otherwise
  it will suggest all cached files.

For all affected commands, completion will always stop at directory
boundary.  Only standard ignored files are excluded, using the
--exclude-standard option of the ls-files command.

When using a recent Bash version, Git path completion will be the same
as builtin file completion, e.g.

	git add contrib/

will suggest relative file names.

Signed-off-by: Manlio Perillo <manlio.perillo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-11 13:22:15 -08:00
Dylan Smith ca87dd623d git-completion.bash: silence "not a valid object" errors
Trying to complete the command

  git show master:./file

would cause a "Not a valid object name" error to be output on standard
error. Silence the error so it won't appear on the command line.

Signed-off-by: Dylan Smith <dylan.ah.smith@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-11 08:44:08 -08:00
Jonathan Nieder 9a6dcb37bd contrib/vim: simplify instructions for old vim support
Rely on the upstream filetype.vim instead of duplicating its rules in
git's instructions for syntax highlighting support on pre-7.2 vim
versions.

The result is a shorter contrib/vim/README.  More importantly, it lets
us punt on maintenance of the autocmd rules.

So now when we fix the upstream gitsendemail rule in light of commit
eed6ca7, new git users stuck on old vim reading contrib/vim/README can
automagically get the fix without any further changes needed to git.

Once the world has moved on to vim 7.2+ completely, we can get rid of
these instructions, but for now if they are this simple it's
effortless to keep them.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10 14:58:54 -08:00
Junio C Hamano a70472f4d6 Merge branch 'fc/remote-bzr'
New remote helper for bzr, with minimum fix squashed in.

* fc/remote-bzr:
  remote-bzr: detect local repositories
  remote-bzr: add support for older versions of bzr
  remote-bzr: add support to push special modes
  remote-bzr: add support for fecthing special modes
  remote-bzr: add simple tests
  remote-bzr: update working tree upon pushing
  remote-bzr: add support for remote repositories
  remote-bzr: add support for pushing
  Add new remote-bzr transport helper
2013-01-09 08:26:26 -08:00
Junio C Hamano 48b7f52455 Merge branch 'er/python-version-requirements'
Some python scripts we ship cannot be run with older versions of the
interpreter.

* er/python-version-requirements:
  Add checks to Python scripts for version dependencies.
2013-01-09 08:25:48 -08:00
Junio C Hamano 414c78ccff Merge branch 'maint'
* maint:
  t1402: work around shell quoting issue on NetBSD
  remote-hg: Fix biridectionality -> bidirectionality typos
2013-01-08 13:23:46 -08:00
Junio C Hamano 4208fa5ce4 Merge branch 'ms/subtree-fixlets' into maint
* ms/subtree-fixlets:
  git-subtree: fix typo in manpage
  git-subtree: ignore git-subtree executable
2013-01-08 11:17:10 -08:00
W. Trevor King 831d57a0f5 remote-hg: Fix biridectionality -> bidirectionality typos
Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-08 09:37:05 -08:00
Marc Khouzam 92f1c04243 Prevent space after directories in tcsh completion
If git-completion.bash returns a single directory as a completion,
tcsh will automatically add a space after it, which is not what the
user wants.

This commit prevents tcsh from doing this.

Also, a check is added to make sure the tcsh version used is recent
enough to allow completion to work as expected.

Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-07 11:51:26 -08:00
Adam Spiers 368aa52952 add git-check-ignore sub-command
This works in a similar manner to git-check-attr.

Thanks to Jeff King and Junio C Hamano for the idea:
http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108815

Signed-off-by: Adam Spiers <git@adamspiers.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-06 14:26:38 -08:00